summaryrefslogtreecommitdiff
path: root/tests/Makefile.tests
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2013-04-26 05:43:31 -0700
committerJon Loeliger <jdl@jdl.com>2013-04-28 07:30:49 -0500
commit4e76ec796c90d44d417f82d9db2d67cfe575f8ed (patch)
treed74894ae6551eaec1a1ee1b322ba3e051fe0f58d /tests/Makefile.tests
parenta6d55e039fd22048687fe061b4609e2807efe764 (diff)
downloaddevice-tree-compiler-4e76ec796c90d44d417f82d9db2d67cfe575f8ed.tar.gz
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> Acked-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/Makefile.tests')
-rw-r--r--tests/Makefile.tests3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/Makefile.tests b/tests/Makefile.tests
index d59bff8..dafb618 100644
--- a/tests/Makefile.tests
+++ b/tests/Makefile.tests
@@ -20,7 +20,8 @@ LIB_TESTS_L = get_mem_rsv \
dtb_reverse dtbs_equal_unordered \
add_subnode_with_nops path_offset_aliases \
utilfdt_test \
- integer-expressions
+ integer-expressions \
+ subnode_iterate
LIB_TESTS = $(LIB_TESTS_L:%=$(TESTS_PREFIX)%)
LIBTREE_TESTS_L = truncated_property