Skip to content

ACPI: glue: Rework ACPI companion lookup related to device type

Rafael J. Wysocki dri-devel linux-acpi linux-usb 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3ACPI: glue: Rename struct acpi_bus_type to acpi_dev_typedrivers/acpi/glue.c drivers/gpu/drm/drm_sysfs.c drivers/thunderbolt/acpi.c +2 more+36 -360 replies
2/3ACPI: glue: Change (un)register_acpi_dev_type() to void functionsdrivers/acpi/glue.c drivers/thunderbolt/acpi.c drivers/thunderbolt/tb.h +3 more+18 -200 replies
3/3ACPI: glue: Simplify struct acpi_dev_type and its usagedrivers/acpi/glue.c drivers/gpu/drm/drm_sysfs.c drivers/thunderbolt/acpi.c +2 more+72 -890 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/3] ACPI: glue: Rework ACPI companion lookup related to device type

Hi All,

The ACPI "glue" code is responsible for binding Linux devices (like platform devices for one example) to their ACPI companions (represented by struct acpi_device objects). This is done by acpi_device_notify() when the given device is registered.

If the device's ACPI companion is set already at that point, the binding simply adds the device to the list of "physical nodes" associated with its ACPI companion. That's the case for PCI devices and platform devices, for example. However, there are cases in which the ACPI companion is not set upfront and it needs to be looked up via "lookup helpers" registered by the subsystems the devices in question belong to. This series changes the "lookup helpers" representation and handling.

Before the changes, the "lookup helpers" are represented by struct acpi_bus_type objects which is doubly confusing because they have nothing to do with bus types and because the "acpi_bus_type" name is also used elsewhere. Patch [1/3] renames struct acpi_bus_type to struct acpi_dev_type because all of the existing "lookup helpers" operate on device types.

Next, the registration and unregistration functions for "lookup helpers" are defined to return an int, but all of their existing users effectively discard their return values (they are discarded right away or passed up the call chain and then discarded). Patch [2/3] changes the return type of those functions to void.

Finally, since all of the existing "lookup helpers" match dev->type to a certain device type, they can be rearranged to point to the device types in question and provide a .find_companion() callback, and an additional .setup() callback in one case. This is done by patch [3/3] and allows all of the affected code to be simplified quite a bit.

Thanks!