[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iDhOFDX=k7xsC_=2jjerWmrP+Na-9PFM=YGA0V-hH2xw@mail.gmail.com>
Date: Sat, 7 Oct 2023 12:43:08 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Michal Wilczynski <michal.wilczynski@...el.com>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
nvdimm@...ts.linux.dev, rafael.j.wysocki@...el.com,
lenb@...nel.org, dan.j.williams@...el.com,
vishal.l.verma@...el.com, ira.weiny@...el.com
Subject: Re: [PATCH v2 3/6] ACPI: AC: Replace acpi_driver with platform_driver
On Sat, Oct 7, 2023 at 12:41 PM Rafael J. Wysocki <rafael@...nel.org> wrote:
>
> On Sat, Oct 7, 2023 at 9:56 AM Andy Shevchenko
> <andriy.shevchenko@...el.com> 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@...el.com> 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.
Powered by blists - more mailing lists