[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=Mc9k9Brxw9eQxLS75ukin1o3D6P6FrX=nbfhgM7_e9W_A@mail.gmail.com>
Date: Mon, 18 Sep 2023 10:03:39 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v3 07/11] gpiolib: replace find_chip_by_name() with gpio_device_find_by_label()
On Mon, Sep 18, 2023 at 9:23 AM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Fri, Sep 15, 2023 at 05:03:22PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> >
> > Remove all remaining uses of find_chip_by_name() (and subsequently:
> > gpiochip_find()) from gpiolib.c and use the new
> > gpio_device_find_by_label() instead.
>
> ...
>
> > -static int gpiochip_match_name(struct gpio_chip *gc, void *data)
> > -{
> > - const char *name = data;
> > -
> > - return !strcmp(gc->label, name);
>
> And this we had no check for the label being NULL...
>
Yeah, it was wrong. But maybe all kernel users already do assign it in
which case we should be safe just adding a check in
gpiochip_add_data_with_key() that would return EINVAL if they don't.
> ...
>
> > for (p = &table->table[0]; p->key; p++) {
> > + struct gpio_device *gdev __free(gpio_device_put) = NULL;
>
> > + gdev = gpio_device_find_by_label(p->key);
> > + if (!gdev) {
>
> I haven't got the fix for gpio-sim, shouldn't we have the same here, i.e.
> definition being done together with the assignment when __free() is in use?
>
It should but I only got yelled at by Linus under the gpio-sim patch
after I sent this one.
Bart
> > }
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Powered by blists - more mailing lists