Discussion:
[PATCH] staging: speakup: remove simple_strtoul
Gabriel Fedel
2018-04-10 23:16:12 UTC
Permalink
Substitute simple_strtoul by kstrtoul (simple_strtoul is obsolete)

Signed-off-by: Gabriel Fedel <***@fedel.net.br>
---
drivers/staging/speakup/kobjects.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index f1f9022..278b1cf 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -154,7 +154,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj,
continue;
}

- index = simple_strtoul(cp, &temp, 10);
+ index = kstrtoul(cp, &temp, 10);
if (index > 255) {
rejected++;
cp = linefeed + 1;
@@ -787,7 +787,7 @@ static ssize_t message_store_helper(const char *buf, size_t count,
continue;
}

- index = simple_strtoul(cp, &temp, 10);
+ index = kstrtoul(cp, &temp, 10);

while ((temp < linefeed) && (*temp == ' ' || *temp == '\t'))
temp++;
--
2.1.4
Gabriel Fedel
2018-04-23 11:20:46 UTC
Permalink
Post by Gabriel Fedel
Substitute simple_strtoul by kstrtoul (simple_strtoul is obsolete)
Hi Gabriel,
Hi Gabriel!
Post by Gabriel Fedel
---
drivers/staging/speakup/kobjects.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index f1f9022..278b1cf 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -154,7 +154,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj,
continue;
}
- index = simple_strtoul(cp, &temp, 10);
+ index = kstrtoul(cp, &temp, 10);
Did you test compiled the kernel with your changes?
I thought I had compiled...
The definition of kstrtoul is different from simple_strtoul, and
compiling the kernel with your patch triggers the following build
linux/kernel.h:332:32: note: expected ‘unsigned int’ but argument is of type ‘char **’
static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
^~~~~~~~
warning: passing argument 3 of ‘kstrtoul’ makes pointer from integer without a cast [-Wint-conversion]
index = kstrtoul(cp, &temp, 10);
I will check again, and send another patch.

Thank you for review, and sorry for the errors!
Post by Gabriel Fedel
if (index > 255) {
rejected++;
cp = linefeed + 1;
@@ -787,7 +787,7 @@ static ssize_t message_store_helper(const char *buf, size_t count,
continue;
}
- index = simple_strtoul(cp, &temp, 10);
+ index = kstrtoul(cp, &temp, 10);
while ((temp < linefeed) && (*temp == ' ' || *temp == '\t'))
temp++;
--
Gabriel Fedel
Loading...