[dpdk-dev] [PATCH] igb_uio: kernel version check for using kstrtoul or strict_strtoul

Helin Zhang helin.zhang at intel.com
Wed Dec 10 03:38:19 CET 2014


strict_strtoul() was just a redefinition of kstrtoul() for a long
time. From kernel version of 3.18, strict_strtoul() will not be
defined at all. A compile time kernel version check is needed to
decide which function or macro can be used for a specific version
of kernel.

Signed-off-by: Helin Zhang <helin.zhang at intel.com>
---
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index d1ca26e..2fcc5f4 100644
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -83,7 +83,11 @@ store_max_vfs(struct device *dev, struct device_attribute *attr,
 	unsigned long max_vfs;
 	struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
 	if (0 != strict_strtoul(buf, 0, &max_vfs))
+#else
+	if (0 != kstrtoul(buf, 0, &max_vfs))
+#endif
 		return -EINVAL;
 
 	if (0 == max_vfs)
-- 
1.9.3



More information about the dev mailing list