summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-02-25 09:32:38 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-03-06 11:41:27 +0100
commitb50c00a61dd240db7b882e6fe848d1835797f3cb (patch)
tree111add03ef7e70815cc3b928bf755ff7bedd451b /include
parenta7b46162b48da9da029e2dd6907b5fb136a3e616 (diff)
downloadbarebox-b50c00a61dd240db7b882e6fe848d1835797f3cb.tar.gz
barebox-b50c00a61dd240db7b882e6fe848d1835797f3cb.tar.xz
of: remove allnodes list
The allnodes list makes it hard to handle multiple devicetrees. Having a list to iterate over all nodes of a tree is still good to have though. This patch uses the list_head of the root node as the head of the list. This way the root node is no longer part of the list, but when iterating over a tree the root node is not interesting anyway. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/of.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/of.h b/include/of.h
index f3fc2aead3..816627357c 100644
--- a/include/of.h
+++ b/include/of.h
@@ -79,6 +79,14 @@ struct fdt_header *fdt_get_tree(void);
#define device_node_for_nach_child(node, child) \
list_for_each_entry(child, &node->children, parent_list)
+/*
+ * Iterate over all nodes of a tree. As a devicetree does not
+ * have a dedicated list head, the start node (usually the root
+ * node) will not be iterated over.
+ */
+#define of_tree_for_each_node(node, root) \
+ list_for_each_entry(node, &root->list, list)
+
/* Helper to read a big number; size is in cells (not bytes) */
static inline u64 of_read_number(const __be32 *cell, int size)
{