Skip to content

Commit 3c36fe9

Browse files
committed
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>
1 parent 7e57714 commit 3c36fe9

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

drivers/acpi/bus.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,12 @@ struct bus_type acpi_bus_type = {
10431043
.remove = acpi_device_remove,
10441044
.uevent = acpi_device_uevent,
10451045
};
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);
10471052

10481053
/* --------------------------------------------------------------------------
10491054
Initialization/Cleanup

drivers/usb/typec/port-mapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ int typec_link_ports(struct typec_port *con)
5959
if (!has_acpi_companion(&con->dev))
6060
return 0;
6161

62-
bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match);
62+
acpi_bus_for_each_dev(typec_port_match, &arg);
6363
if (!arg.match)
6464
return 0;
6565

include/acpi/acpi_bus.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,8 @@ void acpi_initialize_hp_context(struct acpi_device *adev,
480480
/* acpi_device.dev.bus == &acpi_bus_type */
481481
extern struct bus_type acpi_bus_type;
482482

483+
int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data);
484+
483485
/*
484486
* Events
485487
* ------

0 commit comments

Comments
 (0)