dm: core: Add functions for iterating through device children
Buses need to iterate through their children in some situations. Add a few
functions to make this easy.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
diff --git a/include/dm/device.h b/include/dm/device.h
index e08d496..160cd58 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -280,4 +280,22 @@
int device_get_child_by_of_offset(struct udevice *parent, int seq,
struct udevice **devp);
+/**
+ * device_find_first_child() - Find the first child of a device
+ *
+ * @parent: Parent device to search
+ * @devp: Returns first child device, or NULL if none
+ * @return 0
+ */
+int device_find_first_child(struct udevice *parent, struct udevice **devp);
+
+/**
+ * device_find_first_child() - Find the first child of a device
+ *
+ * @devp: Pointer to previous child device on entry. Returns pointer to next
+ * child device, or NULL if none
+ * @return 0
+ */
+int device_find_next_child(struct udevice **devp);
+
#endif