Hi @ll, this is a discussion stemming from drivers/auxdisplay about the usage and possible deprecation of simple_strto* set of functions found in lib/vsprintf. I cc'ed everybody who signed off and also everybody who signed/authored/added/removed more than 20% of lib/vsprintf.
This has come up, because some auxdisplay functionality was broken by a well-intentioned patch to switch from simple_strtoul to kstrtoul in 129957069e6af42a6e021d90679c56662c95f7e1 (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=129957069e6af42a6e021d90679c56662c95f7e1) and now there is discussion about whether the simple_strto* functions are really obsolete. On 26 Feb 2018 18:26, Miguel Ojeda wrote: > On Mon, Feb 26, 2018 at 6:09 PM, Andy Shevchenko wrote: >> On Mon, Feb 26, 2018 at 6:54 PM, Miguel Ojeda wrote: >>> On Mon, Feb 26, 2018 at 12:44 PM, Andy Shevchenko wrote: >>>> Perhaps instead of dancing around kstrtox() better to switch to >>>> simple_strtoul() ? >>> >>> It seems deprecated: >>> >>> /* Obsolete, do not use. Use kstrto<foo> instead */ >>> extern unsigned long simple_strtoul(const char *,char **,unsigned int); >> >> It has been discussed several times. The comment is simple wrong. >> >> Because of the requirement of kstrtox() to have a \0 or \n followed by >> \0 as "end of field". >> simple_strto*() is suitable to be run in place. > > I agree that in-place versions of these kind of string functions are > very useful, don't get me wrong! But unless someone changes the > "official" comment, we shouldn't add new code relying on them. So can we get clarity in form of a patch here, or not? I'm hesitant to move back to simple_kstroul, because to me it seems that general consensus (at least when the comment was put there) was to remove it: > commit 462e471107624fe9bd8b6353ac13e06305c3f3fd > Author: Eldad Zack <> > Date: Mon Dec 17 16:03:05 2012 -0800 > > simple_strto*: annotate function as obsolete > > Update the documentation for simple_strto* to reflect that it has been > obsoleted and advise the usage of kstrto*. > > Signed-off-by: Eldad Zack <> > Cc: J. Bruce Fields <> > Cc: Joe Perches <> > Cc: Randy Dunlap <> > Cc: Alexey Dobriyan <> > Cc: Rob Landley <> > Signed-off-by: Andrew Morton <> > Signed-off-by: Linus Torvalds <> One big advantage simple_kstro* functions have over their kstrto* cousins is that strings don't need to be null-terminated. Instead, they will be parsed as far as they can be and a pointer to the end of the respective number will be returned. Regards, Robert

