mbox series

[0/2] ACPI: scan: Introduce a replacement for acpi_bus_get_device()

Message ID 2828957.e9J7NaK4W3@kreacher
Headers show
Series ACPI: scan: Introduce a replacement for acpi_bus_get_device() | expand

Message

Rafael J. Wysocki Dec. 3, 2021, 4:34 p.m. UTC
Hi All,

Because acpi_bus_get_device() turned out to be problematic in the past, it has
been changed to the point that its calling convention doesn't make much sense
any more (ie. the pointer passed to it as the second argument is cleared on
errors and it can only return one error value if that pointer is nonzero, so
there is some duplication of information in there) and it has to make redundant
checks.

Moreover, its name suggests some kind of reference counting which really isn't
the case.

Thus patch [1/2] introduces a replacement for it, called acpi_fetch_acpi_dev(),
and makes the code in scan.c use it instead of acpi_bus_get_device() internally.

Patch [2/2] updates all of the callers of acpi_bus_get_device() within the ACPI
subsystem to use the replacement (which involves fixing a couple of bugs related
to that).

Thanks!

Comments

Hans de Goede Dec. 6, 2021, 9:04 a.m. UTC | #1
Hi,

On 12/3/21 17:34, Rafael J. Wysocki wrote:
> Hi All,
> 
> Because acpi_bus_get_device() turned out to be problematic in the past, it has
> been changed to the point that its calling convention doesn't make much sense
> any more (ie. the pointer passed to it as the second argument is cleared on
> errors and it can only return one error value if that pointer is nonzero, so
> there is some duplication of information in there) and it has to make redundant
> checks.
> 
> Moreover, its name suggests some kind of reference counting which really isn't
> the case.
> 
> Thus patch [1/2] introduces a replacement for it, called acpi_fetch_acpi_dev(),
> and makes the code in scan.c use it instead of acpi_bus_get_device() internally.
> 
> Patch [2/2] updates all of the callers of acpi_bus_get_device() within the ACPI
> subsystem to use the replacement (which involves fixing a couple of bugs related
> to that).

Thanks, the series looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

for the series.

Regards,

Hans
Mika Westerberg Dec. 7, 2021, 11:30 a.m. UTC | #2
On Fri, Dec 03, 2021 at 05:34:58PM +0100, Rafael J. Wysocki wrote:
> Hi All,
> 
> Because acpi_bus_get_device() turned out to be problematic in the past, it has
> been changed to the point that its calling convention doesn't make much sense
> any more (ie. the pointer passed to it as the second argument is cleared on
> errors and it can only return one error value if that pointer is nonzero, so
> there is some duplication of information in there) and it has to make redundant
> checks.
> 
> Moreover, its name suggests some kind of reference counting which really isn't
> the case.
> 
> Thus patch [1/2] introduces a replacement for it, called acpi_fetch_acpi_dev(),
> and makes the code in scan.c use it instead of acpi_bus_get_device() internally.
> 
> Patch [2/2] updates all of the callers of acpi_bus_get_device() within the ACPI
> subsystem to use the replacement (which involves fixing a couple of bugs related
> to that).

Makes perfect sense!

For the series,

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>