diff options
| author | Stefano Babic <[email protected]> | 2020-05-10 13:03:56 +0200 |
|---|---|---|
| committer | Stefano Babic <[email protected]> | 2020-05-10 13:03:56 +0200 |
| commit | b77d0292ca9f3ca69259dca7e2c5e193a403b289 (patch) | |
| tree | 0af352de3e405f839188aad7acaa9930d18afdd8 /include/dm | |
| parent | 8142a97d541ef1473925b3677d6bf86bcddb69ac (diff) | |
| parent | c5c657644bc35fd6b3d6e5517698721e90646b8d (diff) | |
Merge branch 'master' of git://git.denx.de/u-boot
Diffstat (limited to 'include/dm')
| -rw-r--r-- | include/dm/ofnode.h | 8 | ||||
| -rw-r--r-- | include/dm/read.h | 13 |
2 files changed, 21 insertions, 0 deletions
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 618fc10390e..a0d3df77868 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -880,6 +880,14 @@ ofnode ofnode_by_prop_value(ofnode from, const char *propname, node = ofnode_next_subnode(node)) /** + * ofnode_get_child_count() - get the child count of a ofnode + * + * @node: valid node to get its child count + * @return the number of subnodes + */ +int ofnode_get_child_count(ofnode parent); + +/** * ofnode_translate_address() - Translate a device-tree address * * Translate an address from the device-tree into a CPU physical address. This diff --git a/include/dm/read.h b/include/dm/read.h index 03c15b85506..b952551d555 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 */ /** |
