lkml.org 
[lkml]   [2023]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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@bgdev.pl> wrote:
>
> On Tue, Sep 12, 2023 at 1:16 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Tue, Sep 12, 2023 at 12:07:23PM +0200, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.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
> >
> >

\
 
 \ /
  Last update: 2023-09-15 11:46    [W:0.053 / U:0.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site