diff options
author | Simon Glass <sjg@chromium.org> | 2015-03-25 12:21:57 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-18 11:11:19 -0600 |
commit | c5785673bc6f4b8f2a4974979710a2c5c15eb063 (patch) | |
tree | 664a8e740827abdd48b4b3959155052c2842d35b /include | |
parent | 206d4d2b4b30889678bb6b064002013a427b1501 (diff) | |
download | u-boot-imx-c5785673bc6f4b8f2a4974979710a2c5c15eb063.zip u-boot-imx-c5785673bc6f4b8f2a4974979710a2c5c15eb063.tar.gz u-boot-imx-c5785673bc6f4b8f2a4974979710a2c5c15eb063.tar.bz2 |
dm: core: Add device children and sibling functions
Add some utility functions to check for children and for the last sibling in
a device's parent.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/dm/device.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/dm/device.h b/include/dm/device.h index ec22885..c11342c 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -380,4 +380,34 @@ int device_find_next_child(struct udevice **devp); */ fdt_addr_t dev_get_addr(struct udevice *dev); +/** + * device_has_children() - check if a device has any children + * + * @dev: Device to check + * @return true if the device has one or more children + */ +bool device_has_children(struct udevice *dev); + +/** + * device_has_active_children() - check if a device has any active children + * + * @dev: Device to check + * @return true if the device has one or more children and at least one of + * them is active (probed). + */ +bool device_has_active_children(struct udevice *dev); + +/** + * device_is_last_sibling() - check if a device is the last sibling + * + * This function can be useful for display purposes, when special action needs + * to be taken when displaying the last sibling. This can happen when a tree + * view of devices is being displayed. + * + * @dev: Device to check + * @return true if there are no more siblings after this one - i.e. is it + * last in the list. + */ +bool device_is_last_sibling(struct udevice *dev); + #endif |