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

From: Bartosz Golaszewski

Date: Tue Apr 07 2026 - 10:44:51 EST


On Tue, Apr 7, 2026 at 4:33 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Tue, Apr 07, 2026 at 03:27:58PM +0200, Bartosz Golaszewski wrote:
> > 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.
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
>
> ...
>
> > ret = swnode_gpio_get_reference(fwnode, propname, idx, &args);
>
> > if (ret == 0)
> > break;
>
> Maybe check for an error first? Dunno. Up to you.
>
> if (ret == -ENOTCONN)
> ...
> if (ret)
> continue;
>
> /* The reference is found, bail out */
> break;
>
> (Also may be done in a separate change no need to mix these things
> in the proposed change.)
>
> > + 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);
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

Yes, I mentioned it in one of the earlier revisions. I'll do it
separately and only continue the loop on -ENOENT.

Bart