Re: [PATCH v1 2/7] ACPI: PM: Introduce acpi_device_init_power()
"Rafael J. Wysocki (Intel)" <[email protected]>
| Newsgroups | org.kernel.vger.linux-acpi,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci,org.kernel.vger.linux-pm |
|---|---|
| Message-ID | <CAJZ5v0iJ6Vu4+ZmZP+OLWX6WbfZkiU6uueV9qrPmjKquBmkdRQ@mail.gmail.com> |
On Tue, Sep 1, 2026 at 10:29 AM Andy Shevchenko <[email protected]> wrote: > > 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. Nope, but I think that it's useful. > > result = acpi_device_get_power(device, &state); > > if (result) > > ... > > > +int acpi_device_init_power(struct acpi_device *device) > > Ah, here is a helper! Yeah, I guess it's better to fold it into the first patch. > > +{ > > + int ret; > > Elsewhere in the file it's called 'result'. Yes, it is. So I guess you're suggesting to also use that name here, which is fair enough. > > + > > + ret = __acpi_device_init_power(device); > > + if (ret) > > + device->flags.power_manageable = 0; > > + > > + return ret; > > +}