mbox series

[v1,0/5] ACPI: Device enumeration rearrangements and parent field elimination

Message ID 12036348.O9o76ZdvQC@kreacher
Headers show
Series ACPI: Device enumeration rearrangements and parent field elimination | expand

Message

Rafael J. Wysocki Aug. 10, 2022, 4:11 p.m. UTC
Hi All,

There are still opportunities to clean up the ACPI support code and
this series is part of the effort in that direction.

It makes changes without functional impact (AFAICS) to the core ACPI
code related to devices and to some of its users.

Please refer to the patch changelogs for details.

Thanks!

Comments

Guenter Roeck Aug. 10, 2022, 4:30 p.m. UTC | #1
On 8/10/22 09:14, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Because acpi_bus_get_acpi_device() is completely analogous to
> acpi_fetch_acpi_dev(), rename it to acpi_get_acpi_dev() and
> add a kerneldoc comment to it.
> 
> Accordingly, rename acpi_bus_put_acpi_device() to acpi_put_acpi_dev()
> and update all of the users of these two functions.
> 
> While at it, move the acpi_fetch_acpi_dev() header next to the
> acpi_get_acpi_dev() header in the header file holding them.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>   drivers/acpi/bus.c               |    6 +++---
>   drivers/acpi/device_pm.c         |    4 ++--
>   drivers/acpi/irq.c               |    4 ++--
>   drivers/acpi/scan.c              |   21 ++++++++++++++++-----
>   drivers/hwmon/acpi_power_meter.c |    2 +-

For hwmon:

Acked-by: Guenter Roeck <linux@roeck-us.net>
Mika Westerberg Aug. 10, 2022, 5:10 p.m. UTC | #2
On Wed, Aug 10, 2022 at 06:23:05PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The parent field in struct acpi_device is, in fact, redundant,
> because the dev.parent field in it effectively points to the same
> object and it is used by the driver core.
> 
> Accordingly, the parent field can be dropped from struct acpi_device
> and for this purpose define acpi_dev_parent() to retrieve the parent
> struct acpi_device pointer from the dev.parent field in struct
> acpi_device.  Next, update all of the users of the parent field
> in struct acpi_device to use acpi_dev_parent() instead of it and
> drop it.
> 
> While at it, drop the ACPI_IS_ROOT_DEVICE() macro that is only used
> in one place in a confusing way.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> I may have missed some places where adev->parent is used directly, so
> if that's happened, please let me know (I'm assuming that 0-day will
> pick up this patch and run it through all of the relevant configs
> anyway).
> 
> ---
>  drivers/acpi/acpi_platform.c |    6 +++---
>  drivers/acpi/acpi_video.c    |    2 +-
>  drivers/acpi/device_pm.c     |   19 ++++++++++---------
>  drivers/acpi/property.c      |    6 ++++--
>  drivers/acpi/sbs.c           |    2 +-
>  drivers/acpi/sbshc.c         |    2 +-
>  drivers/acpi/scan.c          |   17 ++++++-----------
>  drivers/hv/vmbus_drv.c       |    3 ++-
>  drivers/spi/spi.c            |    2 +-
>  drivers/thunderbolt/acpi.c   |    2 +-

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Punit Agrawal Aug. 12, 2022, 1:11 p.m. UTC | #3
Hi Rafael,

"Rafael J. Wysocki" <rjw@rjwysocki.net> writes:

> Hi All,
>
> There are still opportunities to clean up the ACPI support code and
> this series is part of the effort in that direction.
>
> It makes changes without functional impact (AFAICS) to the core ACPI
> code related to devices and to some of its users.
>
> Please refer to the patch changelogs for details.

Other than the single typo I noticed in Patch 2, the changes look good!

If it helps,

Reviewed-by: Punit Agrawal <punit.agrawal@bytedance.com>

Thanks,
Punit

[...]
Wei Liu Aug. 12, 2022, 3:14 p.m. UTC | #4
On Wed, Aug 10, 2022 at 06:23:05PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The parent field in struct acpi_device is, in fact, redundant,
> because the dev.parent field in it effectively points to the same
> object and it is used by the driver core.
> 
> Accordingly, the parent field can be dropped from struct acpi_device
> and for this purpose define acpi_dev_parent() to retrieve the parent
> struct acpi_device pointer from the dev.parent field in struct
> acpi_device.  Next, update all of the users of the parent field
> in struct acpi_device to use acpi_dev_parent() instead of it and
> drop it.
> 
> While at it, drop the ACPI_IS_ROOT_DEVICE() macro that is only used
> in one place in a confusing way.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> I may have missed some places where adev->parent is used directly, so
> if that's happened, please let me know (I'm assuming that 0-day will
> pick up this patch and run it through all of the relevant configs
> anyway).
> 
> ---
[...]
>  drivers/hv/vmbus_drv.c       |    3 ++-

Acked-by: Wei Liu <wei.liu@kernel.org>
Rafael J. Wysocki Aug. 23, 2022, 4:25 p.m. UTC | #5
On Fri, Aug 12, 2022 at 3:11 PM Punit Agrawal
<punit.agrawal@bytedance.com> wrote:
>
> Hi Rafael,
>
> "Rafael J. Wysocki" <rjw@rjwysocki.net> writes:
>
> > Hi All,
> >
> > There are still opportunities to clean up the ACPI support code and
> > this series is part of the effort in that direction.
> >
> > It makes changes without functional impact (AFAICS) to the core ACPI
> > code related to devices and to some of its users.
> >
> > Please refer to the patch changelogs for details.
>
> Other than the single typo I noticed in Patch 2,

I've fixed that one while applying the patch.

> the changes look good!
>
> If it helps,
>
> Reviewed-by: Punit Agrawal <punit.agrawal@bytedance.com>

Thank you!