From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by dpdk.org (Postfix) with ESMTP id 981A1B352 for ; Fri, 18 Jul 2014 18:14:13 +0200 (CEST) Received: by mail-pd0-f175.google.com with SMTP id r10so3801409pdi.20 for ; Fri, 18 Jul 2014 09:15:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:user-agent:date:from:to:cc:subject :references:mime-version:content-type:content-disposition; bh=HV5q9gjuYoAMDj2NI7B/cQyD5ZYndfPSfuE9eT/Y7dU=; b=NF9j0KaD/OzfC8JUYI97t5T4dvg9TVybgkMja07m09ssp+n+cQIQP8CG5mJKmplVU9 ov1I4DiyhAmZ+mlEuTkO6YN4c0a021XRYP5cx3FomTatDVJ4z3yIc2l3ZXqQSVC7oM6t QMkIT956wEm2IM7sDYTw7qiJPnJvG7CGYXXPbe8Cr3k3Q3A42kL/VHsEhr0VpV4CXI9f Pm774lJ933O4qITeVRKNnOGaq74NxKWF/qW6c/fwIflUwGsf+7iKS80kvnWxRo68tLJh NixXI6t3umIh6D8PN89MVLc642jI65bQ1Dd440K8DA+wHwJrIhwTwsord9ORdQECDczm cYrg== X-Gm-Message-State: ALoCoQmINltJqoIT/QQp7VrFZo5QNw+C7tgnHggn/toe1LD1V0oC5bg5NqUSrm+UceeSdlsTo775 X-Received: by 10.68.189.105 with SMTP id gh9mr6610267pbc.42.1405700114048; Fri, 18 Jul 2014 09:15:14 -0700 (PDT) Received: from localhost (static-50-53-66-61.bvtn.or.frontiernet.net. [50.53.66.61]) by mx.google.com with ESMTPSA id et1sm6017351pbc.39.2014.07.18.09.15.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jul 2014 09:15:13 -0700 (PDT) Message-Id: <20140718161516.157268908@networkplumber.org> User-Agent: quilt/0.63-1 Date: Fri, 18 Jul 2014 09:14:50 -0700 From: Stephen Hemminger To: Thomas Monjalon References: <20140718161447.020882834@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=igb_uio-better-pci-num-vf.patch Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH 03/10] igb_uio: dont wrap pci_num_vf function needlessly X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2014 16:14:14 -0000 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 2014-06-19 14:29:57.587687790 -0700 +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c 2014-06-19 14:59:14.000000000 -0700 @@ -83,9 +83,8 @@ igbuio_get_uio_pci_dev(struct uio_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 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;