summaryrefslogtreecommitdiff
path: root/drivers/acpi/bus.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2022-06-13 21:26:47 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2022-06-20 21:33:15 +0300
commitff32e59947c87b01dc25a8b5763d609c1a8f56eb (patch)
tree863d4075428b441b3cae9b2250a5482303f1af97 /drivers/acpi/bus.c
parent0ea3ef240c49113cefbaab1f3dbf5b7f46837fc0 (diff)
downloadlinux-ff32e59947c87b01dc25a8b5763d609c1a8f56eb.tar.xz
ACPI: bus: Introduce acpi_dev_for_each_child_reverse()
Make it possible to walk the children of an ACPI device in the revese order by defining acpi_dev_for_each_child_reverse() in analogy with acpi_dev_for_each_child(). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/acpi/bus.c')
-rw-r--r--drivers/acpi/bus.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 7027ff2edfba..4d7c51a33b01 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1115,6 +1115,18 @@ int acpi_dev_for_each_child(struct acpi_device *adev,
return device_for_each_child(&adev->dev, &adwc, acpi_dev_for_one_check);
}
+int acpi_dev_for_each_child_reverse(struct acpi_device *adev,
+ int (*fn)(struct acpi_device *, void *),
+ void *data)
+{
+ struct acpi_dev_walk_context adwc = {
+ .fn = fn,
+ .data = data,
+ };
+
+ return device_for_each_child_reverse(&adev->dev, &adwc, acpi_dev_for_one_check);
+}
+
/* --------------------------------------------------------------------------
Initialization/Cleanup
-------------------------------------------------------------------------- */