On Sat, Oct 7, 2023 at 12:41 PM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote: > > On Sat, Oct 7, 2023 at 9:56 AM Andy Shevchenko > <andriy.shevchenko@xxxxxxxxx> wrote: > > > > 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. > > What data duplication exactly do you mean? > > struct acpi_device *device is replaced with struct device *dev which > is the same size. The latter is then used to obtain a struct > acpi_device pointer. Why is it better to do this than to store the > struct acpi_device itself? This should be "store the struct acpi_device pointer itself", sorry.