[PATCH v4 2/2] gpio: swnode: defer probe on references to unregistered software nodes

Bartosz Golaszewski
2026-04-07T13:28:18Z

fwnode_property_get_reference_args() now returns -ENOTCONN 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 -ENOTCONN.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/gpio/gpiolib-swnode.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/gpio/gpiolib-swnode.c b/drivers/gpio/gpiolib-swnode.c
index 0d7f3f09a0b4bee0cf1bbdaa8b7b8ae4cd5de581..4374067f621ed782a7e1549f7b0b7e44eac04930 100644
--- a/drivers/gpio/gpiolib-swnode.c
+++ b/drivers/gpio/gpiolib-swnode.c
@@ -93,6 +93,14 @@ struct gpio_desc *swnode_find_gpio(struct fwnode_handle *fwnode,
ret = swnode_gpio_get_reference(fwnode, propname, idx, &args);
if (ret == 0)
break;
+ if (ret == -ENOTCONN)
+ /*
+ * -ENOTCONN for a software node reference lookup means
+ * that a remote struct software_node exists but has
+ * not yet been registered as a firmware node. Defer
+ * until this happens.
+ */
+ return ERR_PTR(-EPROBE_DEFER);
}
if (ret) {
pr_debug("%s: can't parse '%s' property of node '%pfwP[%d]'\n",

--
2.47.3