Re: [PATCH 1/4] software node: support automatic secondary fwnode assignment
From: Bartosz Golaszewski
Date: Mon Mar 23 2026 - 12:08:50 EST
On Fri, Mar 20, 2026 at 8:39 AM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Thu, Mar 19, 2026 at 05:10:54PM +0100, Bartosz Golaszewski wrote:
> > Provide a structure and a set of functions allowing to set up automatic
> > secondary firmware node assignment for platform devices. It uses
> > a behind-the-scenes bus notifier for a group of named software nodes. It
> > will wait for bus events and when a device is added, it will check its
> > name against the software node's name and - on match - assign the
> > software node as the secondary firmware node of the device's *real*
> > firmware node.
>
> ...
>
> > +/**
> > + * software_node_register_auto_secondary() - set up automatic assignment of
> > + * secondary firmware nodes
> > + * @auto_sec: Context data to use.
> > + *
> > + * NOTE: All software nodes passed in @auto_sec must be named.
>
> > + * Returns:
>
> Is it with 's' in other kernel-doc? The official is "Return", the 's' variant
> is supported, but not documented.
>
> > + * 0 on success, negative error number on failure.
>
> The Return section must be last in the kernel-doc description. This is documented.
>
> > + * This registers the software node group passed in @auto_sec and sets up
> > + * automatic assignment of them as secondary firmware nodes of real nodes
> > + * attached to appropriate devices on the bus specified in @auto_sec. The
> > + * software nodes must be named and their names must be the same as the
> > + * devices they should reference. The assignment happens when the device is
> > + * first added to the bus.
> > + */
>
> ...
>
> > +/**
> > + * struct software_node_auto_secondary - context data for automatic secondary
> > + * fwnode assignment
> > + * @nb: Private bus notifier data - don't use
>
> Mark it with __private then.
Ok for this and the ones above.
>
> > + * @node_group: NULL-terminated array of software node addresses
> > + * @bus: Bus on which to wait for devices
>
> If bus is not compiled into kernel, this optionally has to support NULL
> in the code (I haven't checked the code, though).
>
The bus type object for given bus is typically defined in whatever
compilation unit contains the implementation of that bus. It's not
possible to access its address if it's not enabled.
Bart