From 819fc2fe2ad99c88d3f57e713d95e01ca2b7f20b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 6 Jun 2014 16:50:32 -0700 Subject: [PATCH] igb_uio: dont wrap pci_num_vf function needlessly It is better style to just use the pci_num_vf directly, rather than wrapping it with a local (but globally named) function with the same effect. Signed-off-by: Stephen Hemminger Acked-by: Thomas Monjalon --- lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c index 69ff58c21a..3eae6d2035 100644 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -83,9 +83,8 @@ igbuio_get_uio_pci_dev(struct uio_info *info) } /* sriov sysfs */ -int local_pci_num_vf(struct pci_dev *dev) -{ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) +static int pci_num_vf(struct pci_dev *dev) struct iov { int pos; int nres; @@ -100,17 +99,15 @@ int local_pci_num_vf(struct pci_dev *dev) return 0; return iov->nr_virtfn; -#else - return pci_num_vf(dev); -#endif } +#endif static ssize_t show_max_vfs(struct device *dev, struct device_attribute *attr, char *buf) { - return snprintf(buf, 10, "%u\n", local_pci_num_vf( - container_of(dev, struct pci_dev, dev))); + return snprintf(buf, 10, "%u\n", + pci_num_vf(container_of(dev, struct pci_dev, dev))); } static ssize_t @@ -126,7 +123,7 @@ store_max_vfs(struct device *dev, struct device_attribute *attr, if (0 == max_vfs) pci_disable_sriov(pdev); - else if (0 == local_pci_num_vf(pdev)) + else if (0 == pci_num_vf(pdev)) err = pci_enable_sriov(pdev, max_vfs); else /* do nothing if change max_vfs number */ err = -EINVAL; -- 2.20.1