From 8e98750fdca7c4fab6033d77d41276a62f3a99bb Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Sat, 4 Mar 2023 11:28:41 +0000 Subject: [PATCH] ACPI: bus: Introduce acpi_dev_for_each_child() mainline inclusion from mainline-v5.19-rc commit cf6ba0750a22a54f5101986401271429995cc4a0 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I67QNJ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=cf6ba0750a22a54f5101986401271429995cc4a0 -------------------------------------------- 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 Reviewed-by: Mika Westerberg Signed-off-by: Zhang Zekun Reviewed-by: Kefeng Wang --- drivers/acpi/bus.c | 6 ++++++ include/acpi/acpi_bus.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index a6a6161474c5..7cc9809264fc 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -966,6 +966,12 @@ struct bus_type acpi_bus_type = { .uevent = acpi_device_uevent, }; +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 -------------------------------------------------------------------------- */ diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index b5ff52052db3..d16a181d8a0e 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -494,6 +494,8 @@ void acpi_bus_detach_private_data(acpi_handle); extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); extern int register_acpi_notifier(struct notifier_block *); extern int unregister_acpi_notifier(struct notifier_block *); +int acpi_dev_for_each_child(struct acpi_device *adev, + int (*fn)(struct device *, void *), void *data); /* * External Functions -- GitLab