diff mbox

[dpdk-dev] eal: replace strict_strtoul with kstrtoul

Message ID 1414134451-1511-1-git-send-email-jmiao@redhat.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Jincheng Miao Oct. 24, 2014, 7:07 a.m. UTC
From upstream kernel commit 3db2e9cd, strict_strto* serial functions
are removed. So that we should directly used kstrtoul instead.

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
---
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c       | 4 ++--
 lib/librte_eal/linuxapp/kni/kni_vhost.c         | 2 +-
 lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Comments

Thomas Monjalon Oct. 30, 2014, 12:04 a.m. UTC | #1
Hi Jincheng,

2014-10-24 15:07, Jincheng Miao:
> From upstream kernel commit 3db2e9cd, strict_strto* serial functions
> are removed. So that we should directly used kstrtoul instead.

kstrtoul appeared in version 2.6.39 in commit 33ee3b2e2eb9b
("kstrto*: converting strings to integers done (hopefully) right")

So we need a compatibility fallback.

Thanks
Jincheng Miao Oct. 30, 2014, 2:30 a.m. UTC | #2
On 10/30/2014 08:04 AM, Thomas Monjalon wrote:
> Hi Jincheng,
>
> 2014-10-24 15:07, Jincheng Miao:
>>  From upstream kernel commit 3db2e9cd, strict_strto* serial functions
>> are removed. So that we should directly used kstrtoul instead.
> kstrtoul appeared in version 2.6.39 in commit 33ee3b2e2eb9b
> ("kstrto*: converting strings to integers done (hopefully) right")
>
> So we need a compatibility fallback.

Hi Thomas,

The solution could be simple, we could check the version of kernel,
and define a macro kstrtoul for old kernel.

Regards & thanks,
Jincheng Miao


>
> Thanks
diff mbox

Patch

diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index d1ca26e..47ff2f3 100644
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -83,7 +83,7 @@  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 (0 != strict_strtoul(buf, 0, &max_vfs))
+	if (0 != kstrtoul(buf, 0, &max_vfs))
 		return -EINVAL;
 
 	if (0 == max_vfs)
@@ -174,7 +174,7 @@  store_max_read_request_size(struct device *dev,
 	unsigned long size = 0;
 	int ret;
 
-	if (strict_strtoul(buf, 0, &size) != 0)
+	if (0 != kstrtoul(buf, 0, &size))
 		return -EINVAL;
 
 	ret = pcie_set_readrq(pci_dev, (int)size);
diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index fe512c2..ba0c1ac 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -739,7 +739,7 @@  set_sock_en(struct device *dev, struct device_attribute *attr,
 	unsigned long en;
 	int err = 0;
 
-	if (0 != strict_strtoul(buf, 0, &en))
+	if (0 != kstrtoul(buf, 0, &en))
 		return -EINVAL;
 
 	if (en)
diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
index dfb271d..8a3727d 100644
--- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
+++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
@@ -123,7 +123,7 @@  store_memsize(struct device *dev, struct device_attribute *attr,
 	int err = 0;
 	unsigned long mem_size;
 
-	if (0 != strict_strtoul(buf, 0, &mem_size))
+	if (0 != kstrtoul(buf, 0, &mem_size))
 		return  -EINVAL;
 
 	mutex_lock(&dom0_dev.data_lock);