public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] fdt: introudce fdt_get_child_count
@ 2016-01-31  6:38 Peng Fan
  2016-01-31 13:19 ` Fabio Estevam
  2016-01-31 15:37 ` Simon Glass
  0 siblings, 2 replies; 4+ messages in thread
From: Peng Fan @ 2016-01-31  6:38 UTC (permalink / raw)
  To: u-boot

Introudce fdt_get_child_count for get the number of subnodes of
one parent node.

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
---
 include/libfdt.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/include/libfdt.h b/include/libfdt.h
index e48c21a..94d29e6 100644
--- a/include/libfdt.h
+++ b/include/libfdt.h
@@ -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                                                  */
 /**********************************************************************/
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] fdt: introudce fdt_get_child_count
  2016-01-31  6:38 [U-Boot] [PATCH] fdt: introudce fdt_get_child_count Peng Fan
@ 2016-01-31 13:19 ` Fabio Estevam
  2016-01-31 15:37 ` Simon Glass
  1 sibling, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-01-31 13:19 UTC (permalink / raw)
  To: u-boot

On Sun, Jan 31, 2016 at 4:38 AM, Peng Fan <van.freenix@gmail.com> wrote:
> Introudce fdt_get_child_count for get the number of subnodes of

s/Introudce/Introduce

Same error in Subject.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] fdt: introudce fdt_get_child_count
  2016-01-31  6:38 [U-Boot] [PATCH] fdt: introudce fdt_get_child_count Peng Fan
  2016-01-31 13:19 ` Fabio Estevam
@ 2016-01-31 15:37 ` Simon Glass
  2016-02-01  1:13   ` Peng Fan
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Glass @ 2016-01-31 15:37 UTC (permalink / raw)
  To: u-boot

Hi Peng,

On 30 January 2016 at 23:38, Peng Fan <van.freenix@gmail.com> wrote:
> Introudce fdt_get_child_count for get the number of subnodes of
> one parent node.
>
> Signed-off-by: Peng Fan <van.freenix@gmail.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  include/libfdt.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/include/libfdt.h b/include/libfdt.h
> index e48c21a..94d29e6 100644
> --- a/include/libfdt.h
> +++ b/include/libfdt.h
> @@ -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)

Does this need to be inline. It doesn't seem important to me.

> +{
> +       int subnode;
> +       int num = 0;
> +
> +       fdt_for_each_subnode(fdt, subnode, node)
> +               num++;
> +
> +       return num;
> +}
> +
>  /**********************************************************************/
>  /* General functions                                                  */
>  /**********************************************************************/
> --
> 2.6.2
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] fdt: introudce fdt_get_child_count
  2016-01-31 15:37 ` Simon Glass
@ 2016-02-01  1:13   ` Peng Fan
  0 siblings, 0 replies; 4+ messages in thread
From: Peng Fan @ 2016-02-01  1:13 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Sun, Jan 31, 2016 at 08:37:45AM -0700, Simon Glass wrote:
>Hi Peng,
>
>On 30 January 2016 at 23:38, Peng Fan <van.freenix@gmail.com> wrote:
>> Introudce fdt_get_child_count for get the number of subnodes of
>> one parent node.
>>
>> Signed-off-by: Peng Fan <van.freenix@gmail.com>
>> Cc: Simon Glass <sjg@chromium.org>
>> ---
>>  include/libfdt.h | 18 ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>>
>> diff --git a/include/libfdt.h b/include/libfdt.h
>> index e48c21a..94d29e6 100644
>> --- a/include/libfdt.h
>> +++ b/include/libfdt.h
>> @@ -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)
>
>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

>
>> +{
>> +       int subnode;
>> +       int num = 0;
>> +
>> +       fdt_for_each_subnode(fdt, subnode, node)
>> +               num++;
>> +
>> +       return num;
>> +}
>> +
>>  /**********************************************************************/
>>  /* General functions                                                  */
>>  /**********************************************************************/
>> --
>> 2.6.2
>>
>
>Regards,
>Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-01  1:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-31  6:38 [U-Boot] [PATCH] fdt: introudce fdt_get_child_count Peng Fan
2016-01-31 13:19 ` Fabio Estevam
2016-01-31 15:37 ` Simon Glass
2016-02-01  1:13   ` Peng Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox