aboutsummaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
Diffstat (limited to 'src/device')
-rw-r--r--src/device/device_const.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/device/device_const.c b/src/device/device_const.c
index de404dc0d1..add253b511 100644
--- a/src/device/device_const.c
+++ b/src/device/device_const.c
@@ -70,6 +70,19 @@ DEVTREE_CONST struct device *dev_find_path(
return result;
}
+DEVTREE_CONST struct device *dev_find_matching_device_on_bus(const struct bus *bus,
+ match_device_fn fn)
+{
+ DEVTREE_CONST struct device *child = NULL;
+
+ while ((child = dev_bus_each_child(bus, child)) != NULL) {
+ if (fn(child))
+ break;
+ }
+
+ return child;
+}
+
/**
* Given a device pointer, find the next PCI device.
*