[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aQh76Qo-PAunVLcr@smile.fi.intel.com>
Date: Mon, 3 Nov 2025 11:54:49 +0200
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 v4 05/10] gpio: swnode: allow referencing GPIO chips by
firmware nodes
On Mon, Nov 03, 2025 at 10:35:25AM +0100, Bartosz Golaszewski wrote:
>
> When doing a software node lookup, we require both the fwnode that
> references a GPIO chip as well as the node associated with that chip to
> be software nodes. However, we now allow referencing generic firmware
> nodes from software nodes in driver core so we should allow the same in
> GPIO core. Make the software node name check optional and dependent on
> whether the referenced firmware node is a software node. If it's not,
> just continue with the lookup.
...
> gdev_node = to_software_node(fwnode);
> - if (!gdev_node || !gdev_node->name)
> - return ERR_PTR(-EINVAL);
The whole patch can be done in two lines (1 changed, 1 added):
goto out_fwnode_lookup;
> - /*
> - * 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(gdev_node->name, GPIOLIB_SWNODE_UNDEFINED_NAME))
> - return ERR_PTR(-ENOENT);
> + if (gdev_node && gdev_node->name) {
> + /*
> + * 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(gdev_node->name, GPIOLIB_SWNODE_UNDEFINED_NAME))
> + return ERR_PTR(-ENOENT);
> + }
out_fwnode_lookup:
> gdev = gpio_device_find_by_fwnode(fwnode);
> return gdev ?: ERR_PTR(-EPROBE_DEFER);
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists