From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Daniel Scally" <djrscally@gmail.com>,
"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Danilo Krummrich" <dakr@kernel.org>,
"Mika Westerberg" <mika.westerberg@linux.intel.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Linus Walleij" <linusw@kernel.org>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Len Brown" <lenb@kernel.org>,
linux-acpi@vger.kernel.org, driver-core@lists.linux.dev,
linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
platform-driver-x86@vger.kernel.org, brgl@kernel.org
Subject: Re: [PATCH v2 2/4] gpio: swnode: defer probe on references to unregistered software nodes
Date: Thu, 2 Apr 2026 14:04:37 -0700 [thread overview]
Message-ID: <ac7ZA6HJFBhyCROM@google.com> (raw)
In-Reply-To: <20260402-baytrail-real-swnode-v2-2-6f5054a4cc07@oss.qualcomm.com>
On Thu, Apr 02, 2026 at 02:54:27PM +0200, Bartosz Golaszewski wrote:
> fwnode_property_get_reference_args() now returns -ENXIO when called on a
> software node referencing another software node which has not yet been
> registered as a firmware node. It makes sense to defer probe in this
> situation as the node will most likely be registered later on and we'll
> be able to resolve the reference eventually. Change the behavior of
> swnode_find_gpio() to return -EPROBE_DEFER if the software node reference
> resolution returns -ENXIO.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
> drivers/gpio/gpiolib-swnode.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpio/gpiolib-swnode.c b/drivers/gpio/gpiolib-swnode.c
> index 0d7f3f09a0b4bee0cf1bbdaa8b7b8ae4cd5de581..06d74e9e199de0b91a019e5e15d4b83d330291e7 100644
> --- a/drivers/gpio/gpiolib-swnode.c
> +++ b/drivers/gpio/gpiolib-swnode.c
> @@ -95,6 +95,15 @@ struct gpio_desc *swnode_find_gpio(struct fwnode_handle *fwnode,
> break;
> }
> if (ret) {
> + if (ret == -ENXIO)
I'll be just sitting here and quoting sashiko all day long ;)
"
If swnode_gpio_get_reference() returns -ENXIO during the first iteration
(for example, when checking the con_id-gpios suffix), won't the loop continue
since the return value is not 0?
Looking at the loop just above this block:
for_each_gpio_property_name(propname, con_id) {
ret = swnode_gpio_get_reference(fwnode, propname, idx, &args);
if (ret == 0)
break;
}
If the initial property check returns -ENXIO, but the subsequent fallback
check for the con_id-gpio suffix returns -ENOENT, the ret variable gets
overwritten.
When the loop terminates, ret would be -ENOENT instead of -ENXIO. Could this
cause the probe deferral check to evaluate to false and fail the probe
entirely instead of deferring it as intended?
Should the loop also break early if -ENXIO is encountered?
"
You need to change that to
if (ret == 0 || ret == -ENXIO)
break;
because if we get -ENXIO that means the GPIO must be there (the property
exists) but not ready yet and we do not want to fall back to another
suffix.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2026-04-02 21:04 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 12:54 [PATCH v2 0/4] platform/x86: x86-android-tablets: use real firmware node references with intel drivers Bartosz Golaszewski
2026-04-02 12:54 ` [PATCH v2 1/4] software node: return -ENXIO when referenced swnode is not registered yet Bartosz Golaszewski
2026-04-02 13:35 ` Andy Shevchenko
2026-04-02 20:43 ` Dmitry Torokhov
2026-04-03 7:29 ` Bartosz Golaszewski
2026-04-03 18:07 ` Dmitry Torokhov
2026-04-07 10:57 ` Bartosz Golaszewski
2026-04-07 13:30 ` Bartosz Golaszewski
2026-04-07 13:59 ` Andy Shevchenko
2026-04-02 12:54 ` [PATCH v2 2/4] gpio: swnode: defer probe on references to unregistered software nodes Bartosz Golaszewski
2026-04-02 21:04 ` Dmitry Torokhov [this message]
2026-04-03 7:26 ` Bartosz Golaszewski
2026-04-03 13:44 ` Bartosz Golaszewski
2026-04-02 12:54 ` [PATCH v2 3/4] ACPI: bus: export the acpi_bus_type symbol Bartosz Golaszewski
2026-04-02 12:54 ` [PATCH v2 4/4] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips Bartosz Golaszewski
2026-04-04 18:25 ` Rafael J. Wysocki
2026-04-27 11:30 ` Bartosz Golaszewski
2026-04-02 13:23 ` [PATCH v2 0/4] platform/x86: x86-android-tablets: use real firmware node references with intel drivers Andy Shevchenko
2026-04-02 13:35 ` Bartosz Golaszewski
2026-04-02 13:47 ` Andy Shevchenko
2026-04-02 15:03 ` Bartosz Golaszewski
2026-04-02 16:05 ` Andy Shevchenko
2026-04-02 16:13 ` Bartosz Golaszewski
2026-04-02 16:18 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ac7ZA6HJFBhyCROM@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=dakr@kernel.org \
--cc=djrscally@gmail.com \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=lenb@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.