|
@@ -393,4 +393,20 @@ int uclass_resolve_seq(struct udevice *dev);
|
|
|
#define uclass_foreach_dev_safe(pos, next, uc) \
|
|
|
list_for_each_entry_safe(pos, next, &uc->dev_head, uclass_node)
|
|
|
|
|
|
+/**
|
|
|
+ * uclass_foreach_dev_probe() - Helper function to iteration through devices
|
|
|
+ * of given uclass
|
|
|
+ *
|
|
|
+ * This creates a for() loop which works through the available devices in
|
|
|
+ * a uclass in order from start to end. Devices are probed if necessary,
|
|
|
+ * and ready for use.
|
|
|
+ *
|
|
|
+ * @id: Uclass ID
|
|
|
+ * @dev: struct udevice * to hold the current device. Set to NULL when there
|
|
|
+ * are no more devices.
|
|
|
+ */
|
|
|
+#define uclass_foreach_dev_probe(id, dev) \
|
|
|
+ for (int _ret = uclass_first_device_err(id, &dev); !_ret && dev; \
|
|
|
+ _ret = uclass_next_device_err(&dev))
|
|
|
+
|
|
|
#endif
|