On Fri, Oct 06, 2023 at 09:47:57PM +0200, Rafael J. Wysocki wrote: > On Fri, Oct 6, 2023 at 8:33 PM Michal Wilczynski > <michal.wilczynski@xxxxxxxxx> wrote: ... > > struct acpi_ac { > > struct power_supply *charger; > > struct power_supply_desc charger_desc; > > - struct acpi_device *device; > > + struct device *dev; > > I'm not convinced about this change. > > If I'm not mistaken, you only use the dev pointer above to get the > ACPI_COMPANION() of it, but the latter is already found in _probe(), > so it can be stored in struct acpi_ac for later use and then the dev > pointer in there will not be necessary any more. > > That will save you a bunch of ACPI_HANDLE() evaluations and there's > nothing wrong with using ac->device->handle. The patch will then > become almost trivial AFAICS and if you really need to get from ac to > the underlying platform device, a pointer to it can be added to struct > acpi_ac without removing the ACPI device pointer from it. The idea behind is to eliminate data duplication. > > unsigned long long state; > > struct notifier_block battery_nb; > > }; -- With Best Regards, Andy Shevchenko