Though I like this patch, it shows direct style, but it will change the meaning of a function not mentioned here. int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) So far seems no driver call pci_sriov_set_totalvfs() with numvfs = 0 and the patch will change the behavior of the drivers, but it will definitely change the test cases and documents related to IOV. Thanks, Ethan On Thu, Jul 31, 2014 at 10:24 PM, Edward Cree <ecree@xxxxxxxxxxxxxx> wrote: > Make a driver_max_VFs of 0 mean 0, instead of total_VFs as previously. > Initialise driver_max_VFs to total_VFs instead of 0. > > Signed-off-by: Edward Cree <ecree@xxxxxxxxxxxxxx> > --- > Only existing callers are ixgbe and igb, and neither passes 0, so this > doesn't break existing users. > --- > drivers/pci/iov.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c > index cb6f247..fb51467 100644 > --- a/drivers/pci/iov.c > +++ b/drivers/pci/iov.c > @@ -381,7 +381,7 @@ found: > iov->pos = pos; > iov->nres = nres; > iov->ctrl = ctrl; > - iov->total_VFs = total; > + iov->driver_max_VFs = iov->total_VFs = total; > iov->offset = offset; > iov->stride = stride; > iov->pgsz = pgsz; > @@ -686,9 +686,6 @@ int pci_sriov_get_totalvfs(struct pci_dev *dev) > if (!dev->is_physfn) > return 0; > > - if (dev->sriov->driver_max_VFs) > - return dev->sriov->driver_max_VFs; > - > - return dev->sriov->total_VFs; > + return dev->sriov->driver_max_VFs; > } > EXPORT_SYMBOL_GPL(pci_sriov_get_totalvfs); > -- > 1.7.11.7 > The information contained in this message is confidential and is intended for the addressee(s) only. If you have received this message in error, please notify the sender immediately and delete the message. Unless you are an addressee (or authorized to receive for an addressee), you may not use, copy or disclose to anyone this message or any information contained in this message. The unauthorized use, disclosure, copying or alteration of this message is strictly prohibited. > -- > 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 -- 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