Simon Glass 88f95bbadd libfdt: Add fdt_next_subnode() to permit easy subnode iteration
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) {
		/* code body */
	}
}

Using fdt_next_subnode() we can instead write this, which is shorter and
easier to get right:

for (offset = fdt_first_subnode(fdt, parent_offset);
     offset >= 0;
     offset = fdt_next_subnode(fdt, offset)) {
	/* code body */
}

Also, it doesn't require two levels of indentation for the loop body.

Signed-off-by: Simon Glass <sjg@chromium.org>
(Cherry-picked from dtc commit 4e76ec79)
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
2013-05-14 15:37:25 -04:00
..
2012-12-06 13:56:38 -07:00
2012-05-25 09:15:10 +02:00
2012-11-04 11:00:36 -07:00
2012-05-15 08:31:37 +02:00
2012-03-29 08:12:47 +02:00
2012-09-29 07:26:08 -07:00
2013-05-01 16:41:08 -04:00
2013-05-01 16:41:08 -04:00
2012-04-29 14:14:08 +02:00
2012-07-07 14:07:32 +02:00
2012-04-10 23:35:32 +02:00
2013-04-12 14:13:13 -07:00
2013-02-19 17:01:26 -05:00