[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200927123932.GA20442@sol>
Date: Sun, 27 Sep 2020 20:39:32 +0800
From: Kent Gibson <warthog618@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Linus Walleij <linus.walleij@...aro.org>,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH v9 07/20] gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL
and GPIO_V2_LINE_GET_VALUES_IOCTL
On Sun, Sep 27, 2020 at 12:00:04PM +0300, Andy Shevchenko wrote:
> On Sat, Sep 26, 2020 at 12:16 PM Kent Gibson <warthog618@...il.com> wrote:
> > On Fri, Sep 25, 2020 at 01:06:02PM +0300, Andy Shevchenko wrote:
>
> ...
>
> > Hmmm, there is more to it than I thought - gpiod_request_commit(),
> > which this code eventually calls, interprets a null label (not an
> > empty string) as indicating that the user has not set the label, in
> > which case it will set the desc label to "?". So userspace cannot
> > force the desc label to be empty.
> >
> > We need to keep that label as null in that case to maintain that
> > behaviour.
> >
> > I will add a comment there though.
> >
> > Hmmm, having said that, does this form work for you:
> >
> > if (ulr.consumer[0] != '\0') {
> > /* label is only initialized if consumer is set */
> > lr->label = kstrndup(ulr.consumer, sizeof(ulr.consumer) - 1, GFP_KERNEL);
> > ...
> >
> > It actually compiles slightly larger, I guess due to the extra parameter
> > in the kstrndup() call, but may be slightly more readable??
>
> I really don't want to delay this series, choose what you think is
> better and we may amend it later.
>
OK, as this code is common with v1 I'll leave it as is - we can always
change it for all cases in a later patch.
I think that is everything outstanding for v9, so should have a v10 out
shortly.
Cheers,
Kent.
Powered by blists - more mailing lists