[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=MeNNGXy6aAanLnbWFYJiK65dvm_HyjCDS1=LZ4RiA4GAA@mail.gmail.com>
Date: Fri, 24 Oct 2025 09:17:25 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Linus Walleij <linus.walleij@...aro.org>, Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>, Philipp Zabel <p.zabel@...gutronix.de>,
Krzysztof Kozlowski <krzk@...nel.org>, 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 4/9] gpio: swnode: don't use the swnode's name as the
key for GPIO lookup
On Wed, Oct 22, 2025 at 8:44 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Wed, Oct 22, 2025 at 03:41:03PM +0200, Bartosz Golaszewski wrote:
> >
> > Looking up a GPIO controller by label that is the name of the software
> > node is wonky at best - the GPIO controller driver is free to set
> > a different label than the name of its firmware node. We're already being
> > passed a firmware node handle attached to the GPIO device to
> > swnode_get_gpio_device() so use it instead for a more precise lookup.
>
> ...
>
> > static struct gpio_device *swnode_get_gpio_device(struct fwnode_handle *fwnode)
> > {
> > + struct gpio_device *gdev __free(gpio_device_put) =
> > + gpio_device_find_by_fwnode(fwnode);
> > + if (!gdev)
> > + return ERR_PTR(-EPROBE_DEFER);
> >
> > /*
> > * Check for a special node that identifies undefined GPIOs, this is
> > * primarily used as a key for internal chip selects in SPI bindings.
> > */
> > if (IS_ENABLED(CONFIG_GPIO_SWNODE_UNDEFINED) &&
> > + !strcmp(fwnode_get_name(fwnode), GPIOLIB_SWNODE_UNDEFINED_NAME))
> > return ERR_PTR(-ENOENT);
>
> Now we might get EPROBE_DEREF for the cases when previously it was ENOENT.
> Why is this not a problem? (I haven't found the answer neither in the comment
> above, nor in the commit message)
>
Yeah, maybe it should only change the last part from looking up by
label to looking up by fwnode and leave the previous checks in place.
Bart
Powered by blists - more mailing lists