Re: [PATCH] pci/msi: Allow arch code to return the number of MSI-X available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 19, 2009 at 12:07:30PM +1100, Michael Ellerman wrote:
> There is code in msix_capability_init() which, when the requested number
> of MSI-X couldn't be allocated, calculates how many MSI-X /could/ be
> allocated and returns that to the driver. That allows the driver to then
> make a second request, with a number of MSIs that should succeed.
> 
> The current code requires the arch code to setup as many msi_descs as it
> can, and then return to the generic code. On some platforms the arch
> code may already know how many MSI-X it can allocate, before it sets up
> any of the msi_descs.

Would it be fair to say that those platforms are the same ones which
implement arch_msi_check_device(), which already works for this case?

> @@ -43,7 +43,8 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
>  	list_for_each_entry(entry, &dev->msi_list, list) {
>  		ret = arch_setup_msi_irq(dev, entry);
>  		if (ret)
> -			return ret;
> +			/* Ensure the error code is always < 0 */
> +			return min(ret, -ret);
>  	}
>  
>  	return 0;

I really don't like this.  If we're returning an error, we should return
a sensible error value.  Something like:

		if (ret < 0)
			return ret;
		if (ret > 0)
			return -ENOSPC;

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux