diff options
| author | Chunfeng Yun <[email protected]> | 2020-05-02 11:35:09 +0200 |
|---|---|---|
| committer | Marek Vasut <[email protected]> | 2020-05-02 12:32:28 +0200 |
| commit | 89b84b85e9c5d80e1b5eb5b52cc6596ba32135c7 (patch) | |
| tree | 1c0dfd8bd3db057bf096172aeda6ee77ea22aefd /drivers/core/ofnode.c | |
| parent | c693f212c5b0433b3a49a89d87cbff28bf78eb87 (diff) | |
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 <[email protected]>
Signed-off-by: Frank Wunderlich <[email protected]>
Reviewed-by: Weijie Gao <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'drivers/core/ofnode.c')
| -rw-r--r-- | drivers/core/ofnode.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 20871a68155..e3c42dae5c6 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -474,6 +474,17 @@ ofnode ofnode_get_chosen_node(const char *name) return ofnode_path(prop); } +int ofnode_get_child_count(ofnode parent) +{ + ofnode child; + int num = 0; + + ofnode_for_each_subnode(child, parent) + num++; + + return num; +} + static int decode_timing_property(ofnode node, const char *name, struct timing_entry *result) { |
