[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPkmDWJEKrjlMPnD@smile.fi.intel.com>
Date: Wed, 22 Oct 2025 21:44:29 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
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 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)
> + return no_free_ptr(gdev);
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists