Re: [PATCH v2] libfdt: Add fdt_next_subnode() to permit easy subnode iteration

2013-04-28 Thread Jon Loeliger
> On Fri, Apr 26, 2013 at 05:43:31AM -0700, Simon Glass wrote: > > Iterating through subnodes with libfdt is a little painful to write as we > > need something like this: > > > > for (depth = 0, count = 0, > > offset = fdt_next_node(fdt, parent_offset, &depth); > > (offset >= 0) && (depth

Re: [PATCH v2] libfdt: Add fdt_next_subnode() to permit easy subnode iteration

2013-04-26 Thread David Gibson
On Fri, Apr 26, 2013 at 05:43:31AM -0700, Simon Glass wrote: > Iterating through subnodes with libfdt is a little painful to write as we > need something like this: > > for (depth = 0, count = 0, > offset = fdt_next_node(fdt, parent_offset, &depth); > (offset >= 0) && (depth > 0); >

[PATCH v2] libfdt: Add fdt_next_subnode() to permit easy subnode iteration

2013-04-26 Thread Simon Glass
Iterating through subnodes with libfdt is a little painful to write as we need something like this: for (depth = 0, count = 0, offset = fdt_next_node(fdt, parent_offset, &depth); (offset >= 0) && (depth > 0); offset = fdt_next_node(fdt, offset, &depth)) { if (depth == 1)