summaryrefslogtreecommitdiff
path: root/include/acpi
diff options
context:
space:
mode:
authorDaniel Scally <djrscally@gmail.com>2022-09-22 02:04:36 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2022-09-24 20:12:32 +0300
commit62c8bc0d27a784b09114d67c33e8fa83f350fa77 (patch)
treec668cd57f1447a6bf7d07fc743394cfa10791f3f /include/acpi
parentcca8a7efea6402f463239a1bb337d01b0cad7b2e (diff)
downloadlinux-62c8bc0d27a784b09114d67c33e8fa83f350fa77.tar.xz
ACPI: bus: Add iterator for dependent devices
Add a helper macro to iterate over ACPI devices that are flagged as consumers of an initial supplier ACPI device. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Daniel Scally <djrscally@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/acpi_bus.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index c66d17c3298b..f016c155b462 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -745,6 +745,17 @@ bool acpi_dev_ready_for_enumeration(const struct acpi_device *device);
struct acpi_device *acpi_dev_get_next_consumer_dev(struct acpi_device *supplier,
struct acpi_device *start);
+/**
+ * for_each_acpi_consumer_dev - iterate over the consumer ACPI devices for a
+ * given supplier
+ * @supplier: Pointer to the supplier's ACPI device
+ * @consumer: Pointer to &struct acpi_device to hold the consumer, initially NULL
+ */
+#define for_each_acpi_consumer_dev(supplier, consumer) \
+ for (consumer = acpi_dev_get_next_consumer_dev(supplier, NULL); \
+ consumer; \
+ consumer = acpi_dev_get_next_consumer_dev(supplier, consumer))
+
struct acpi_device *
acpi_dev_get_next_match_dev(struct acpi_device *adev, const char *hid, const char *uid, s64 hrv);
struct acpi_device *