Re: [PATCH 07/11] ACPI: Initialise device child list early to access data nodes early

Sakari Ailus
2022-05-06T14:09:03Z

Hi Rafael,

On Fri, May 06, 2022 at 03:28:10PM +0200, Rafael J. Wysocki wrote:
> On Fri, May 6, 2022 at 2:58 PM Sakari Ailus
> <sakari.ailus@linux.intel.com> wrote:
> >
> > The properties, including data nodes, are initialised in
> > acpi_init_device_object(). Traversing the data nodes also requires the
> > device's child list to be initialised which happens much later in
> > __acpi_device_add(). The function also makes the device visible in the
> > system, so setting up its properties and nodes is too late by then.
> >
> > To address this, move the child list initialisation before
> > acpi_init_properties() in acpi_init_device_object().
> >
> > Note that this is currently not an issue as the properties will only be
> > accessed by drivers. In the near future accessing the properties will be
> > done in the ACPI framework itself, and doing so requires this change.
> >
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>
> There is a problem with this that the children list is redundant and
> not really safe to use and so it will be dropped. I actually have a
> series of patches to do that in the works.
>
> I'm also unsure why it would be necessary to initialize the list of
> the device's children earlier, because adding anything to that list
> requires a child device object to be registered with cannot happen
> before registering the parent itself.

I actually intended to send this one later if it were to be still relevant.
Please ignore it for now, I'll drop it from v2.

It is currently needed needed for accessing device's data nodes before
registering the device.

--
Sakari Ailus