u-boot-brain/lib/libfdt
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
..
fdt_empty_tree.c libfdt: Add helper function to create a trivial, empty tree 2012-10-15 22:24:36 -04:00
fdt_ro.c Export fdt_stringlist_contains() 2013-05-10 19:04:49 -04:00
fdt_rw.c libfdt: update from upstream dtc commit 142419e 2013-02-07 20:38:55 -05:00
fdt_strerror.c Move libfdt/ into lib/ 2010-04-13 09:13:04 +02:00
fdt_sw.c libfdt: update from upstream dtc commit 142419e 2013-02-07 20:38:55 -05:00
fdt_wip.c libfdt: update from upstream dtc commit 142419e 2013-02-07 20:38:55 -05:00
fdt.c libfdt: Add fdt_next_subnode() to permit easy subnode iteration 2013-05-14 15:37:25 -04:00
libfdt_internal.h libfdt: Implement property iteration functions 2011-07-14 21:10:34 -04:00
Makefile libfdt: Add helper function to create a trivial, empty tree 2012-10-15 22:24:36 -04:00
README Move libfdt/ into lib/ 2010-04-13 09:13:04 +02:00

The libfdt functionality was written by David Gibson.  The original
source came from the git repository:

URL:		git://ozlabs.org/home/dgibson/git/libfdt.git

author		David Gibson <dgibson@sneetch.(none)>
		Fri, 23 Mar 2007 04:16:54 +0000 (15:16 +1100)
committer	David Gibson <dgibson@sneetch.(none)>
		Fri, 23 Mar 2007 04:16:54 +0000 (15:16 +1100)
commit		857f54e79f74429af20c2b5ecc00ee98af6a3b8b
tree		2f648f0f88225a51ded452968d28b4402df8ade0
parent		07a12a08005f3b5cd9337900a6551e450c07b515

To adapt for u-boot usage, only the applicable files were copied and
imported into the u-boot git repository.
Omitted:
* GPL - u-boot comes with a copy of the GPL license
* test subdirectory - not directly useful for u-boot

After importing, other customizations were performed.  See the git log
for details.

Jerry Van Baren