ACPI: bus: Introduce acpi_dev_for_each_child()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 4 Apr 2022 15:21:50 +0000 (17:21 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 13 Apr 2022 15:26:22 +0000 (17:26 +0200)
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@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/acpi/bus.c
include/acpi/acpi_bus.h

index 3e58b613a2c41b599586cd00ac6b6322e59d9290..e807bffc0804db18e14a34f86d97da51722dcd37 100644 (file)
@@ -1070,6 +1070,12 @@ int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data)
 }
 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 c4b78c21d793056f8087711b83bfcdedc801f90c..c616f3d8506b9340c27bda791580d896a7a6aa6c 100644 (file)
@@ -481,6 +481,8 @@ void acpi_initialize_hp_context(struct acpi_device *adev,
 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