Re: [PATCH v1 2/7] ACPI: PM: Introduce acpi_device_init_power()

From: Andy Shevchenko

Date: Tue Sep 01 2026 - 04:35:58 EST


On Mon, Aug 31, 2026 at 06:25:52PM +0200, Rafael J. Wysocki wrote:

> Two out of three callers of acpi_bus_init_power() need to clear
> flags.power_manageable for the target device on errors, which
> is somewhat cumbersome, so rename the function to
> __acpi_device_init_power(), add a wrapper called
> acpi_device_init_power() around it that will take care
> of the flags.power_manageable clearing, and make the two
> callers of acpi_bus_init_power() in question invoke that
> wrapper.
>
> While at it, clean up the declaration of local variables
> in __acpi_device_init_power().

...

> {
> - int state;
> - int result;
> + int result, state;

Not sure if this change is required.

> result = acpi_device_get_power(device, &state);
> if (result)

...

> +int acpi_device_init_power(struct acpi_device *device)

Ah, here is a helper!

> +{
> + int ret;

Elsewhere in the file it's called 'result'.

> +
> + ret = __acpi_device_init_power(device);
> + if (ret)
> + device->flags.power_manageable = 0;
> +
> + return ret;
> +}

--
With Best Regards,
Andy Shevchenko