[PATCH v1 0/3] ACPI: bus: Rework acquiring the primary physical for a given ACPI one

"Rafael J. Wysocki" <[email protected]> Mon, 10 Aug 2026 13:28:44 +0200
Newsgroups gmane.linux.acpi.devel,gmane.linux.kernel
Organization Linux Kernel Development - Intel
Message-ID <[email protected]>
Hi All,

This is somewhat late, but since there will be follow-up changes tree-wide,
it would be good to get it into the mainline sooner than later.

It is based on the observation that the majority of
acpi_get_first_physical_node() callers want to hold a reference on the returned
device and the function is potentially racy because it doesn't get such a
reference itself.  There were also some comments from Sashiko pointing
out to this as a "preexisting issue".

The first patch adds a acpi_get_first_physical_node() replacement called
acpi_bus_get_primary_device() and returning a reference-counted device (the
former is retained for the time being, but made use the same code as the
latter).

The next two patches change the core ACPI code to use the new function
instead of the old one.

Later on, patches will be sent to switch all of the callers of
acpi_get_first_physical_node() over to using acpi_bus_get_primary_device()
and finally to drop the former.

Thanks!