[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMRc=MeVfXKfz=vcgDxToYpTsrSrmD5xh5J6OeEApY4d=qyyTw@mail.gmail.com>
Date: Fri, 15 Sep 2023 11:44:05 +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 v2 07/11] gpiolib: replace find_chip_by_name() with gpio_device_find_by_label()
On Tue, Sep 12, 2023 at 1:35 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:
>
> On Tue, Sep 12, 2023 at 1:16 PM Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
> >
> > On Tue, Sep 12, 2023 at 12:07:23PM +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.
> >
> > ...
> >
> > > for (p = &table->table[0]; p->key; p++) {
> > > - struct gpio_chip *gc;
> > > + struct gpio_device *gdev __free(gpio_device_put) = NULL;
> >
> > > + gc = gpio_device_get_chip(gdev);
> >
> > What the heck is this, btw? You have gdev NULL here.
> >
>
> Gah! Thanks. I relied on tests succeeding and no KASAN warnings, I
> need to go through this line-by-line again.
>
Fortunately, this was just an unused leftover. I fixed it for v3.
Bart
> Bart
>
> > > /* idx must always match exactly */
> > > if (p->idx != idx)
> > > @@ -4004,9 +3996,8 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id,
> > > return ERR_PTR(-EPROBE_DEFER);
> > > }
> > >
> > > - gc = find_chip_by_name(p->key);
> > > -
> > > - if (!gc) {
> > > + gdev = gpio_device_find_by_label(p->key);
> > > + if (!gdev) {
> >
> > ...
> >
> > > if (gc->ngpio <= p->chip_hwnum) {
> > > dev_err(dev,
> > > "requested GPIO %u (%u) is out of range [0..%u] for chip %s\n",
> > > - idx, p->chip_hwnum, gc->ngpio - 1,
> > > + idx, p->chip_hwnum, gdev->chip->ngpio - 1,
> >
> > In other patch you use wrapper to get gdev->chip, why not here?
> >
> > > gc->label);
> >
> > Is this gc is different to gdev->chip?
> >
> > > return ERR_PTR(-EINVAL);
> > > }
> >
> > ...
> >
> > Sorry, but this patch seems to me as WIP. Please, revisit it, make sure all
> > things are done consistently.
> >
> > --
> > With Best Regards,
> > Andy Shevchenko
> >
> >
Powered by blists - more mailing lists