Re: [PATCH 2/2] nvme/pci: Enable SR-IOV capabilities

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

 



On Mon, May 23, 2016 at 12:06:52PM -0500, Bjorn Helgaas wrote:
> > +static int nvme_sriov_configure(struct pci_dev *pdev, int numvfs)
> > +{
> > +	int ret = 0;
> > +
> > +	if (numvfs == 0)
> > +		pci_disable_sriov(pdev);
> > +	else
> > +		ret = pci_enable_sriov(pdev, numvfs);
> > +
> > +	return ret ? ret : numvfs;
> > +}
> 
> I do not subscribe to the belief that every function should have a
> single exit.  In this case, I think it makes the function much harder
> to understand than this:
> 
>   if (numvfs == 0)
>     pci_disable_sriov(pdev);
>     return 0;
>   }
> 
>   return pci_enable_sriov(pdev, numvfs);

I'd tend to agree.  But then again the real issue here is that we should
have two methods instead, and useful defaults.  I.e. if the SR-IOV API
was properly designed NVMe wouldn't even need this callout at all,
and drivers that need it should have one method each for enable /
disable.
--
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