[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <X8aArEe49HKdW6GC@localhost>
Date: Tue, 1 Dec 2020 18:43:08 +0100
From: Johan Hovold <johan@...nel.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Johan Hovold <johan@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
"Mychaela N . Falconia" <falcon@...ecalypso.org>,
"open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
USB <linux-usb@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/5] serial: core: add sysfs attribute to suppress ready
signalling on open
On Tue, Dec 01, 2020 at 03:49:19PM +0200, Andy Shevchenko wrote:
> On Tue, Dec 1, 2020 at 3:21 PM Johan Hovold <johan@...nel.org> wrote:
> > On Tue, Dec 01, 2020 at 01:19:30PM +0200, Andy Shevchenko wrote:
> > > On Tue, Dec 1, 2020 at 1:04 PM Johan Hovold <johan@...nel.org> wrote:
>
> ...
>
> > > > 0x01 is 1 and is generally treated as boolean true as you know.
> > >
> > > Depends how you interpret this. kstrtobool() uses one character (and
> > > in some cases two) of the input. Everything else is garbage.
> > > Should we interpret garbage?
> >
> > No, ideally we should reject the input.
>
> We can do it by the way in kstrtobool() and see if anybody complains
> (I believe the world is saner than relying on 0x01 for false and 123
> for true.
I bet someone is using "YEAH!" just because they can. ;)
> ...
>
> > > > So why should a sysfs-interface accept it as valid input and treat it as
> > > > false? That's just bad design.
> > >
> > > I can agree with this.
> >
> > Looks like part of the problem are commits like 4cc7ecb7f2a6 ("param:
> > convert some "on"/"off" users to strtobool") which destroyed perfectly
> > well-defined interfaces.
>
> Oh, but the strtobool() in ABI was before that, for instance
> % git grep -n -p -w strtobool v3.14
> shows a few dozens of users and some of them looks like ABI.
Indeed, it apparently goes further back than strtobool(). The series
introducing strtobool() explicitly mentions the lax parsing and for that
reason wanted to keep it distinct from the other kstrto* function by
dropping the k-prefix:
The naming is still distinct enough from kstrtox to avoid any
implication that this function has the same tight parameter
passing that those functions have.
https://lore.kernel.org/lkml/1303213427-12798-1-git-send-email-jic23@cam.ac.uk/#t
And it was more recently renamed kstrtobool() anyway.
Let's call it a feature then.
Johan
Powered by blists - more mailing lists