提交 3c36fe93 编写于 作者: R Rafael J. Wysocki

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: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com>
上级 7e57714c
...@@ -1043,7 +1043,12 @@ struct bus_type acpi_bus_type = { ...@@ -1043,7 +1043,12 @@ struct bus_type acpi_bus_type = {
.remove = acpi_device_remove, .remove = acpi_device_remove,
.uevent = acpi_device_uevent, .uevent = acpi_device_uevent,
}; };
EXPORT_SYMBOL_GPL(acpi_bus_type);
int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data)
{
return bus_for_each_dev(&acpi_bus_type, NULL, data, fn);
}
EXPORT_SYMBOL_GPL(acpi_bus_for_each_dev);
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Initialization/Cleanup Initialization/Cleanup
......
...@@ -59,7 +59,7 @@ int typec_link_ports(struct typec_port *con) ...@@ -59,7 +59,7 @@ int typec_link_ports(struct typec_port *con)
if (!has_acpi_companion(&con->dev)) if (!has_acpi_companion(&con->dev))
return 0; return 0;
bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match); acpi_bus_for_each_dev(typec_port_match, &arg);
if (!arg.match) if (!arg.match)
return 0; return 0;
......
...@@ -480,6 +480,8 @@ void acpi_initialize_hp_context(struct acpi_device *adev, ...@@ -480,6 +480,8 @@ void acpi_initialize_hp_context(struct acpi_device *adev,
/* acpi_device.dev.bus == &acpi_bus_type */ /* acpi_device.dev.bus == &acpi_bus_type */
extern struct bus_type acpi_bus_type; extern struct bus_type acpi_bus_type;
int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data);
/* /*
* Events * Events
* ------ * ------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册