All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Shevchenko, Andriy" <andriy.shevchenko@intel.com>
Subject: Re: [PATCH 07/11] ACPI: Initialise device child list early to access data nodes early
Date: Fri, 6 May 2022 15:28:10 +0200	[thread overview]
Message-ID: <CAJZ5v0gQR+zFdWqst1D-XYkwwZJkNuBen1-acxFWRY=2Ty6Sdw@mail.gmail.com> (raw)
In-Reply-To: <20220506130025.984026-8-sakari.ailus@linux.intel.com>

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.

> ---
>  drivers/acpi/scan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 762b61f67e6c6..86c4e9a473edc 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -680,7 +680,6 @@ static int __acpi_device_add(struct acpi_device *device,
>          * -------
>          * Link this device to its parent and siblings.
>          */
> -       INIT_LIST_HEAD(&device->children);
>         INIT_LIST_HEAD(&device->node);
>         INIT_LIST_HEAD(&device->wakeup_list);
>         INIT_LIST_HEAD(&device->physical_node_list);
> @@ -1786,6 +1785,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
>         acpi_set_device_status(device, ACPI_STA_DEFAULT);
>         acpi_device_get_busid(device);
>         acpi_set_pnp_ids(handle, &device->pnp, type);
> +       INIT_LIST_HEAD(&device->children);
>         acpi_init_properties(device);
>         acpi_bus_get_flags(device);
>         device->flags.match_driver = false;
> --
> 2.30.2
>

  reply	other threads:[~2022-05-06 13:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 13:00 [PATCH 00/11] ACPI: Buffer property and reference as string support Sakari Ailus
2022-05-06 13:00 ` [PATCH 01/11] ACPI: property: Return type of acpi_add_nondev_subnodes() should be bool Sakari Ailus
2022-05-06 13:00 ` [PATCH 02/11] ACPI: acpica: Constify pathname argument for acpi_get_handle() Sakari Ailus
2022-05-17 16:21   ` Rafael J. Wysocki
2022-05-18 16:14     ` Sakari Ailus
2022-05-18 19:07       ` Rafael J. Wysocki
2022-05-18 19:41         ` Sakari Ailus
2022-05-19 18:05           ` Rafael J. Wysocki
2022-05-20  6:13             ` Sakari Ailus
2022-05-20 14:21               ` Shevchenko, Andriy
2022-05-06 13:00 ` [PATCH 03/11] ACPI: property: Tie data nodes to acpi handles Sakari Ailus
2022-05-06 13:00 ` [PATCH 04/11] ACPI: property: Use acpi_object_type consistently in property ref parsing Sakari Ailus
2022-05-06 13:00 ` [PATCH 05/11] ACPI: property: Move property ref argument parsing into a new function Sakari Ailus
2022-05-06 13:00 ` [PATCH 06/11] ACPI: property: Switch node property referencing from ifs to a switch Sakari Ailus
2022-05-06 13:00 ` [PATCH 07/11] ACPI: Initialise device child list early to access data nodes early Sakari Ailus
2022-05-06 13:28   ` Rafael J. Wysocki [this message]
2022-05-06 14:08     ` Sakari Ailus
2022-05-06 13:00 ` [PATCH 08/11] ACPI: property: Parse data node string references in properties Sakari Ailus
2022-05-06 13:00 ` [PATCH 09/11] ACPI: property: Unify integer value reading functions Sakari Ailus
2022-05-06 13:00 ` [PATCH 10/11] ACPI: property: Add support for parsing buffer property UUID Sakari Ailus
2022-05-06 13:00 ` [PATCH 11/11] ACPI: property: Read buffer properties as integers Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJZ5v0gQR+zFdWqst1D-XYkwwZJkNuBen1-acxFWRY=2Ty6Sdw@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.