[PATCH v1 1/3] ACPI: bus: Introduce acpi_dev_for_each_child()

From: Rafael J. Wysocki
Date: Mon Apr 04 2022 - 11:25:31 EST


From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>

Introduce a wrapper around device_for_each_child() to iterate over
the children of a given ACPI device object.

This function will be used in subsequent change sets.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/acpi/bus.c | 6 ++++++
include/acpi/acpi_bus.h | 2 ++
2 files changed, 8 insertions(+)

Index: linux-pm/drivers/acpi/bus.c
===================================================================
--- linux-pm.orig/drivers/acpi/bus.c
+++ linux-pm/drivers/acpi/bus.c
@@ -1070,6 +1070,12 @@ int acpi_bus_for_each_dev(int (*fn)(stru
}
EXPORT_SYMBOL_GPL(acpi_bus_for_each_dev);

+int acpi_dev_for_each_child(struct acpi_device *adev,
+ int (*fn)(struct device *, void *), void *data)
+{
+ return device_for_each_child(&adev->dev, data, fn);
+}
+
/* --------------------------------------------------------------------------
Initialization/Cleanup
-------------------------------------------------------------------------- */
Index: linux-pm/include/acpi/acpi_bus.h
===================================================================
--- linux-pm.orig/include/acpi/acpi_bus.h
+++ linux-pm/include/acpi/acpi_bus.h
@@ -481,6 +481,8 @@ void acpi_initialize_hp_context(struct a
extern struct bus_type acpi_bus_type;

int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data);
+int acpi_dev_for_each_child(struct acpi_device *adev,
+ int (*fn)(struct device *, void *), void *data);

/*
* Events