From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [PATCH v2 04/10] igb_uio: dont wrap pci_num_vf function needlessly Date: Fri, 06 Jun 2014 16:50:32 -0700 Message-ID: <20140606235106.919627057@networkplumber.org> References: <20140606235028.189345212@networkplumber.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Cc: dev-VfR2kkLFssw@public.gmane.org To: Alan Carew Return-path: Content-Disposition: inline; filename=igb_uio-better-pci-num-vf.patch List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 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 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -98,9 +98,8 @@ } /* 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; @@ -115,17 +114,15 @@ 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 @@ -141,7 +138,7 @@ 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;