Re: [PATCH] software node: allow referencing software nodes by name

From: Andy Shevchenko

Date: Thu Mar 26 2026 - 15:14:49 EST


On Thu, Mar 26, 2026 at 04:47:00PM +0100, Bartosz Golaszewski wrote:
> On Thu, Mar 26, 2026 at 9:48 AM Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > On Thu, Mar 26, 2026 at 10:39:09AM +0200, Andy Shevchenko wrote:
> > > On Thu, Mar 26, 2026 at 09:34:01AM +0100, Bartosz Golaszewski wrote:

...

> > > I believe so. See how we find a GPIO chip in the gpiolib-acpi-core.c.
> > > In the similar way you can try finding any object in ACPI namespace.
> > >
> > > But note, ":00" is part of device instance name, it's not available
> > > in ACPI namespace. There we have HID, UID, et cetera, ":00" is pure
> > > Linux kernel thingy.
> >
> > We have acpi_dev_present(), but if you read its kernel-doc, it suggests
> > to use acpi_get_devices() for the case of early checks (before device
> > are actually being instantiated).
>
> Ah, but I'm seeing that the firmware node handle of the acpi device is
> part of struct acpi_device and is only initialized during the scanning
> phase which happens at subsys_initcall() time?

Sounds correct. With that you can just check the device presence in the table
and maybe evaluate the status (but I'm not sure about the latter).

> When using
> acpi_get_devices() you have an abstract handle and no fwnode for which
> to assign the secondary node yet, right?

You have no fwnode concept in ACPI namespace. It's Linux thingy.
So, yes, until you have a companion device (ACPI device as object of
struct acpi_device), you have fwnode, without that device, there is
no fwnode.

> It's not like with DT where there already is an instance of struct
> device_node to which you can assign the secondary fwnode even if its
> device doesn't exist yet.

Yeah DT in this sense is available earlier because they are just
static data. ACPI needs an interpreter and hence some preparations
to be done before full access to the namespace will be available.

--
With Best Regards,
Andy Shevchenko