Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: bus: Introduce acpi_bus_for_each_dev()

In order to avoid exposing acpi_bus_type to modules, introduce an
acpi_bus_for_each_dev() helper for iterating over all ACPI device
objects and make typec_link_ports() use it instead of the raw
bus_for_each_dev() along with acpi_bus_type.

Having done that, drop the acpi_bus_type export.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

+9 -2
+6 -1
drivers/acpi/bus.c
··· 1043 1043 .remove = acpi_device_remove, 1044 1044 .uevent = acpi_device_uevent, 1045 1045 }; 1046 - EXPORT_SYMBOL_GPL(acpi_bus_type); 1046 + 1047 + int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data) 1048 + { 1049 + return bus_for_each_dev(&acpi_bus_type, NULL, data, fn); 1050 + } 1051 + EXPORT_SYMBOL_GPL(acpi_bus_for_each_dev); 1047 1052 1048 1053 /* -------------------------------------------------------------------------- 1049 1054 Initialization/Cleanup
+1 -1
drivers/usb/typec/port-mapper.c
··· 59 59 if (!has_acpi_companion(&con->dev)) 60 60 return 0; 61 61 62 - bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match); 62 + acpi_bus_for_each_dev(typec_port_match, &arg); 63 63 if (!arg.match) 64 64 return 0; 65 65
+2
include/acpi/acpi_bus.h
··· 480 480 /* acpi_device.dev.bus == &acpi_bus_type */ 481 481 extern struct bus_type acpi_bus_type; 482 482 483 + int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data); 484 + 483 485 /* 484 486 * Events 485 487 * ------