summaryrefslogtreecommitdiff
path: root/include/dm
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-11-18 08:14:31 -0700
committerSimon Glass <sjg@chromium.org>2018-11-29 09:30:05 -0700
commit3abe1115355900172a8681f5e6fa01ca71a9b916 (patch)
tree9c2aeebe14de6b7c227845d8b2df0372bc81cd8f /include/dm
parentd0b4f68d199c075f5d734cf184f7eaf1a642083d (diff)
dm: core: Add a few more specific child-finding functions
Add two functions which can find a child device by uclass or by name. The first is useful with Multi-Function-Devices (MFDs) to find one of a particular type. The second is useful when only the name is known. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm')
-rw-r--r--include/dm/device.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/dm/device.h b/include/dm/device.h
index 847934425b..27a6d7b9fd 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -525,6 +525,8 @@ int device_find_next_child(struct udevice **devp);
* This is used to locate an existing child of a device which is of a given
* uclass.
*
+ * The device is NOT probed
+ *
* @parent: Parent device to search
* @uclass_id: Uclass to look for
* @devp: Returns device found, if any
@@ -535,6 +537,29 @@ int device_find_first_inactive_child(struct udevice *parent,
struct udevice **devp);
/**
+ * device_find_first_child_by_uclass() - Find the first child of a device in uc
+ *
+ * @parent: Parent device to search
+ * @uclass_id: Uclass to look for
+ * @devp: Returns first child device in that uclass, if any
+ * @return 0 if found, else -ENODEV
+ */
+int device_find_first_child_by_uclass(struct udevice *parent,
+ enum uclass_id uclass_id,
+ struct udevice **devp);
+
+/**
+ * device_find_child_by_name() - Find a child by device name
+ *
+ * @parent: Parent device to search
+ * @name: Name to look for
+ * @devp: Returns device found, if any
+ * @return 0 if found, else -ENODEV
+ */
+int device_find_child_by_name(struct udevice *parent, const char *name,
+ struct udevice **devp);
+
+/**
* device_has_children() - check if a device has any children
*
* @dev: Device to check