Re: [Outreachy kernel] [PATCH 2/6] staging: speakup: simple_strtoul is replaced with kstrtoul

From: Julia Lawall
Date: Fri Mar 03 2017 - 13:50:13 EST




On Sat, 4 Mar 2017, Arushi Singhal wrote:

> This patch fixes "simple_strtoul is obsolete, use kstrtoul instead"
> warning.
>
> Signed-off-by: Arushi Singhal <arushisinghal19971997@xxxxxxxxx>
> ---
> drivers/staging/speakup/kobjects.c | 4 ++--
> drivers/staging/speakup/main.c | 2 +-
> drivers/staging/speakup/varhandlers.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
> index edde9e68779e..a82698c66568 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -152,7 +152,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj,
> continue;
> }
>
> - index = simple_strtoul(cp, &temp, 10);
> + index = kstrtoul(cp, &temp, 10);

It seems unlikely that you actually compiled this code. The argument list
for kstrtoul has a completely different set of types.

julia

> if (index > 255) {
> rejected++;
> cp = linefeed + 1;
> @@ -785,7 +785,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++;
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index 17df20ec94be..b43e2e156602 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1945,7 +1945,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
> return 1;
> }
>
> - goto_pos = simple_strtoul(goto_buf, &cp, 10);
> + goto_pos = kstrtoul(goto_buf, &cp, 10);
>
> if (*cp == 'x') {
> if (*goto_buf < '0')
> diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
> index cc984196020f..5107533bb45a 100644
> --- a/drivers/staging/speakup/varhandlers.c
> +++ b/drivers/staging/speakup/varhandlers.c
> @@ -325,7 +325,7 @@ char *spk_s2uchar(char *start, char *dest)
> {
> int val;
>
> - val = simple_strtoul(skip_spaces(start), &start, 10);
> + val = kstrtoul(skip_spaces(start), &start, 10);
> if (*start == ',')
> start++;
> *dest = (u_char)val;
> --
> 2.11.0
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@xxxxxxxxxxxxxxxxx
> To post to this group, send email to outreachy-kernel@xxxxxxxxxxxxxxxxx
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170303183707.14830-3-arushisinghal19971997%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>