public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: speakup: replace simple_strtoul with kstrtou8
@ 2017-03-02 14:28 Marcin Ciupak
  2017-03-02 15:17 ` Samuel Thibault
  0 siblings, 1 reply; 3+ messages in thread
From: Marcin Ciupak @ 2017-03-02 14:28 UTC (permalink / raw)
  To: William Hubbs
  Cc: Chris Brannon, Kirk Reiser, Samuel Thibault, Greg Kroah-Hartman,
	speakup, devel, linux-kernel

Replace simple_strtoul with kstrtou8.
simple_strtoul is marked for obsoletion.

Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
---
 drivers/staging/speakup/varhandlers.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index cc984196020f..c219db745865 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -323,11 +323,10 @@ char *spk_strlwr(char *s)
 
 char *spk_s2uchar(char *start, char *dest)
 {
-	int val;
+	int ret;
 
-	val = simple_strtoul(skip_spaces(start), &start, 10);
+	ret = kstrtou8(skip_spaces(start), 10, dest);
 	if (*start == ',')
 		start++;
-	*dest = (u_char)val;
 	return start;
 }
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: speakup: replace simple_strtoul with kstrtou8
  2017-03-02 14:28 [PATCH] staging: speakup: replace simple_strtoul with kstrtou8 Marcin Ciupak
@ 2017-03-02 15:17 ` Samuel Thibault
  2017-03-03  8:38   ` Marcin Ciupak
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Thibault @ 2017-03-02 15:17 UTC (permalink / raw)
  To: Marcin Ciupak
  Cc: William Hubbs, Chris Brannon, Kirk Reiser, Greg Kroah-Hartman,
	speakup, devel, linux-kernel

Marcin Ciupak, on jeu. 02 mars 2017 15:28:23 +0100, wrote:
> -	int val;
> +	int ret;
>  
> -	val = simple_strtoul(skip_spaces(start), &start, 10);
> +	ret = kstrtou8(skip_spaces(start), 10, dest);

This is not the same, you need to have start properly move, since it's
used below:

>  	if (*start == ',')
>  		start++;
> -	*dest = (u_char)val;
>  	return start;

Samuel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: speakup: replace simple_strtoul with kstrtou8
  2017-03-02 15:17 ` Samuel Thibault
@ 2017-03-03  8:38   ` Marcin Ciupak
  0 siblings, 0 replies; 3+ messages in thread
From: Marcin Ciupak @ 2017-03-03  8:38 UTC (permalink / raw)
  To: Samuel Thibault
  Cc: William Hubbs, Chris Brannon, Kirk Reiser, Greg Kroah-Hartman,
	speakup, devel, linux-kernel

On Thu, Mar 02, 2017 at 04:17:12PM +0100, Samuel Thibault wrote:
> Marcin Ciupak, on jeu. 02 mars 2017 15:28:23 +0100, wrote:
> > -	int val;
> > +	int ret;
> >  
> > -	val = simple_strtoul(skip_spaces(start), &start, 10);
> > +	ret = kstrtou8(skip_spaces(start), 10, dest);
> 
> This is not the same, you need to have start properly move, since it's
> used below:
> 
> >  	if (*start == ',')
> >  		start++;
> > -	*dest = (u_char)val;
> >  	return start;
> 
> Samuel

You are right, start is not updated by kstrtou8 like it is by
simple_strtoul.

If I understand it correctly simple_strtoul cannot be replaced by
kstrtou8 here.

Please discard this patch.

Marcin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-03  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-02 14:28 [PATCH] staging: speakup: replace simple_strtoul with kstrtou8 Marcin Ciupak
2017-03-02 15:17 ` Samuel Thibault
2017-03-03  8:38   ` Marcin Ciupak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox