fdt: introudce fdt_get_child_count
PATCH 1/1 fdt: introudce fdt_get_child_count
Introudce fdt_get_child_count for get the number of subnodes of one parent node.
--- include/libfdt.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
include/libfdt.h +18 -0
@@ -193,6 +193,24 @@ int fdt_next_subnode(const void *fdt, int offset); node >=0 ; \ node = fdt_next_subnode(fdt, node)) +/** +* fdt_get_child_count() - get the number of subnodes of one node +* +* @fdt: FDT blob +* @node: Offset of node +* @return number of child nodes of node, or 0 if there is no subnode. +*/ +static inline int fdt_get_child_count (void *fdt,int node) +{ +int subnode; +int num =0 ; + +fdt_for_each_subnode (fdt, subnode, node) + num++; + +return num; +} +/**********************************************************************/ /* General functions */ /**********************************************************************/
Signature · 1 line
2.6.2
PATCH 1/1 fdt: introudce fdt_get_child_count
Quoted 1 line · Peng Fan
Introudce
fdt_get_child_countfor get the number of subnodes of
s/Introudce/Introduce
Same error in Subject.
PATCH 1/1 fdt: introudce fdt_get_child_count
In reply to Peng FanHi Peng,
Quoted 15 lines · Peng Fan
Introudce
fdt_get_child_countfor get the number of subnodes of one parent node.Signed-off-by Peng Fan <[email protected]>Cc Simon Glass <[email protected]>--- include/libfdt.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)include/libfdt.h +0
-0@@ -193,6 +193,24 @@ int fdt_next_subnode(const void *fdt, int offset); node >=0 ; \
include/libfdt.h int fdt_next_subnode(const void *fdt, int offset); · line 203
Quoted 10 lines
include/libfdt.h +8
-0node = fdt_next_subnode(fdt, node)) +/** +* fdt_get_child_count() - get the number of subnodes of one node +* +* @fdt: FDT blob +* @node: Offset of node +* @return number of child nodes of node, or 0 if there is no subnode. +*/ +static inline int fdt_get_child_count (void *fdt,int node)
Does this need to be inline. It doesn't seem important to me.
Quoted 14 lines
include/libfdt.h +10
-1+{ +int subnode; +int num =0 ; + +fdt_for_each_subnode (fdt, subnode, node) + num++; + +return num; +} +/**********************************************************************/ /* General functions */ /**********************************************************************/ --
Quoted 2 lines
2.6.2
Regards,
Simon
PATCH 1/1 fdt: introudce fdt_get_child_count
Hi Simon,
Quoted 20 lines · Simon Glass
Hi Peng,
Quoted 17 lines · Peng Fan
Introudce
fdt_get_child_countfor get the number of subnodes of one parent node.Signed-off-by Peng Fan <[email protected]>Cc Simon Glass <[email protected]>--- include/libfdt.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)include/libfdt.h +0
-0@@ -193,6 +193,24 @@ int fdt_next_subnode(const void *fdt, int offset); node >=0 ; \ node = fdt_next_subnode(fdt, node))
Quoted 10 lines
include/libfdt.h int fdt_next_subnode(const void *fdt, int offset); · line 203
Quoted 8 lines
include/libfdt.h +8
-0+/** +* fdt_get_child_count() - get the number of subnodes of one node +* +* @fdt: FDT blob +* @node: Offset of node +* @return number of child nodes of node, or 0 if there is no subnode. +*/ +static inline int fdt_get_child_count (void *fdt,int node)Does this need to be inline. It doesn't seem important to me.
I just follow linux kernel and add inline. If inline is not needed, I can move the piece code to lib/fdtdec.c.
You mean this API is not important?
Thanks,
Peng
Quoted 20 lines
Quoted 15 lines
include/libfdt.h +10
-1+{ +int subnode; +int num =0 ; + +fdt_for_each_subnode (fdt, subnode, node) + num++; + +return num; +} +/**********************************************************************/ /* General functions */ /**********************************************************************/ --Quoted 2 lines
2.6.2
Regards,
Simon