Skip to content

Commit 62c8bc0

Browse files
djrscallyrafaeljw
authored andcommitted
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 <[email protected]> Signed-off-by: Daniel Scally <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent cca8a7e commit 62c8bc0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

include/acpi/acpi_bus.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,17 @@ bool acpi_dev_ready_for_enumeration(const struct acpi_device *device);
745745
struct acpi_device *acpi_dev_get_next_consumer_dev(struct acpi_device *supplier,
746746
struct acpi_device *start);
747747

748+
/**
749+
* for_each_acpi_consumer_dev - iterate over the consumer ACPI devices for a
750+
* given supplier
751+
* @supplier: Pointer to the supplier's ACPI device
752+
* @consumer: Pointer to &struct acpi_device to hold the consumer, initially NULL
753+
*/
754+
#define for_each_acpi_consumer_dev(supplier, consumer) \
755+
for (consumer = acpi_dev_get_next_consumer_dev(supplier, NULL); \
756+
consumer; \
757+
consumer = acpi_dev_get_next_consumer_dev(supplier, consumer))
758+
748759
struct acpi_device *
749760
acpi_dev_get_next_match_dev(struct acpi_device *adev, const char *hid, const char *uid, s64 hrv);
750761
struct acpi_device *

0 commit comments

Comments
 (0)