linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Abel <rabel@robertabel.eu>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Willy Tarreau <w@1wt.eu>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	eldad@fogrefinery.com, me@tobin.cc, corbet@lwn.net,
	pantelis.antoniou@konsulko.com
Subject: Re: [PATCH 3/4] auxdisplay: charlcd: fix x/y address commands
Date: Tue, 27 Feb 2018 00:00:42 +0100	[thread overview]
Message-ID: <1b66ecb1-5951-35f3-3dd2-4448628d3fbc@robertabel.eu> (raw)
In-Reply-To: <CANiq72k-bztnMoDR6D_n-ZnK2mFmpUOvNn1ttpPFq=suxrYPig@mail.gmail.com>

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

  parent reply	other threads:[~2018-02-26 23:00 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-09 23:50 [PATCH 0/3] auxdisplay: charlcd: miscellaneous patches Robert Abel
2018-02-09 23:50 ` [PATCH 1/3] auxdisplay: charlcd: fix hex literal ranges for graphics command Robert Abel
2018-02-09 23:50   ` [PATCH 2/3] auxdisplay: charlcd: use null character instead of zero literal to terminate strings Robert Abel
2018-02-09 23:50     ` [PATCH 3/3] auxdisplay: charlcd: replace octal literal with form-feed escape sequence Robert Abel
2018-02-10  9:43       ` Miguel Ojeda
2018-02-10  9:29     ` [PATCH 2/3] auxdisplay: charlcd: use null character instead of zero literal to terminate strings Miguel Ojeda
2018-02-10  8:58   ` [PATCH 1/3] auxdisplay: charlcd: fix hex literal ranges for graphics command Miguel Ojeda
2018-02-10  9:20     ` Willy Tarreau
2018-02-10  9:41       ` Miguel Ojeda
2018-02-12 13:56         ` Miguel Ojeda
2018-02-13 13:36         ` Andy Shevchenko
2018-02-13 19:15           ` Willy Tarreau
2018-02-14 23:17           ` Robert Abel
2018-02-15 10:57             ` Andy Shevchenko
2018-02-25 23:34               ` Robert Abel
2018-02-25 23:52                 ` Robert Abel
2018-02-25 23:54                 ` Robert Abel
2018-02-25 23:54                   ` [PATCH 1/4] auxdisplay: charlcd: fix two-line command ^[[LN not marked as processed Robert Abel
2018-02-25 23:54                     ` [PATCH 2/4] auxdisplay: charlcd: name x/y address struct Robert Abel
2018-02-25 23:54                       ` [PATCH 3/4] auxdisplay: charlcd: fix x/y address commands Robert Abel
2018-02-25 23:54                         ` [PATCH 4/4] auxdisplay: charlcd: make home command unshift display Robert Abel
2018-02-26 17:16                           ` Miguel Ojeda
2018-02-26  8:46                         ` [PATCH 3/4] auxdisplay: charlcd: fix x/y address commands Geert Uytterhoeven
2018-02-26 22:29                           ` Robert Abel
2018-02-26 11:44                         ` Andy Shevchenko
2018-02-26 16:54                           ` Miguel Ojeda
2018-02-26 17:09                             ` Andy Shevchenko
2018-02-26 17:26                               ` Miguel Ojeda
2018-02-26 17:56                                 ` Andy Shevchenko
2018-02-26 23:00                                 ` Robert Abel [this message]
2018-02-26 22:38                           ` Robert Abel
2018-02-26 23:06                             ` Miguel Ojeda
2018-02-26 16:49                         ` Miguel Ojeda
2018-02-26 16:57                           ` Miguel Ojeda
2018-02-26 22:43                           ` Robert Abel
2018-02-27  5:19                             ` Willy Tarreau
2018-02-27 19:31                               ` Miguel Ojeda
2018-02-27 23:29                               ` Robert Abel
2018-02-28  0:05                                 ` [PATCH RFC 0/2] auxdisplay: charlcd: fix movement and home commands Robert Abel
2018-02-28  0:05                                   ` [PATCH 1/2] auxdisplay: charlcd: fix x/y address commands Robert Abel
2018-02-28  0:05                                     ` [PATCH 2/2] auxdisplay: charlcd: make home command unshift display Robert Abel
2018-02-28  4:21                                 ` [PATCH 3/4] auxdisplay: charlcd: fix x/y address commands Willy Tarreau
2018-02-26 23:05                           ` Robert Abel
2018-02-27  5:20                             ` Willy Tarreau
2018-02-26  8:35                       ` [PATCH 2/4] auxdisplay: charlcd: name x/y address struct Geert Uytterhoeven
2018-02-26 15:59                       ` Miguel Ojeda
2018-02-26  8:34                     ` [PATCH 1/4] auxdisplay: charlcd: fix two-line command ^[[LN not marked as processed Geert Uytterhoeven
2018-02-26 15:53                       ` Miguel Ojeda
2018-02-26 23:08                   ` [PATCH 1/3] auxdisplay: charlcd: fix hex literal ranges for graphics command Robert Abel
2018-02-10 18:31     ` Geert Uytterhoeven
2018-02-10 18:58       ` Willy Tarreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b66ecb1-5951-35f3-3dd2-4448628d3fbc@robertabel.eu \
    --to=rabel@robertabel.eu \
    --cc=akpm@linux-foundation.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=corbet@lwn.net \
    --cc=eldad@fogrefinery.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@tobin.cc \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=torvalds@linux-foundation.org \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).