diff options
author | Chunfeng Yun <chunfeng.yun@mediatek.com> | 2020-05-02 11:35:09 +0200 |
---|---|---|
committer | Marek Vasut <marek.vasut+renesas@gmail.com> | 2020-05-02 12:32:28 +0200 |
commit | 89b84b85e9c5d80e1b5eb5b52cc6596ba32135c7 (patch) | |
tree | 1c0dfd8bd3db057bf096172aeda6ee77ea22aefd /include/dm/read.h | |
parent | c693f212c5b0433b3a49a89d87cbff28bf78eb87 (diff) | |
download | u-boot-89b84b85e9c5d80e1b5eb5b52cc6596ba32135c7.tar.gz |
dm: core: Add function to get child count of ofnode or device
This patch add function used to get the child count of
a ofnode or a device
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Weijie Gao <weijie.gao@mediatek.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm/read.h')
-rw-r--r-- | include/dm/read.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/dm/read.h b/include/dm/read.h index 03c15b8550..b952551d55 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -669,6 +669,14 @@ u64 dev_translate_dma_address(const struct udevice *dev, */ int dev_read_alias_highest_id(const char *stem); +/** + * dev_get_child_count() - get the child count of a device + * + * @dev: device to use for interation (struct udevice *) + * @return the count of child subnode + */ +int dev_get_child_count(const struct udevice *dev); + #else /* CONFIG_DM_DEV_READ_INLINE is enabled */ static inline int dev_read_u32(const struct udevice *dev, @@ -978,6 +986,11 @@ static inline int dev_read_alias_highest_id(const char *stem) return fdtdec_get_alias_highest_id(gd->fdt_blob, stem); } +static inline int dev_get_child_count(const struct udevice *dev) +{ + return ofnode_get_child_count(dev_ofnode(dev)); +} + #endif /* CONFIG_DM_DEV_READ_INLINE */ /** |