diff options
author | Simon Glass <sjg@chromium.org> | 2018-11-18 08:14:31 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-11-29 09:30:05 -0700 |
commit | 3abe1115355900172a8681f5e6fa01ca71a9b916 (patch) | |
tree | 9c2aeebe14de6b7c227845d8b2df0372bc81cd8f /include/dm/device.h | |
parent | d0b4f68d199c075f5d734cf184f7eaf1a642083d (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/device.h')
-rw-r--r-- | include/dm/device.h | 25 |
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 |