aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2012-08-14 09:20:23 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-20 05:16:00 -0400
commit3296193d1421c2d6f9e49e181cecfd917f0f5764 (patch)
treee3252ad5cd1979bbdf64f46975b602f474fa2bb3 /include
parent476ad154f3b41dd7d9a08a2f641e28388abc2fd1 (diff)
dt: introduce for_each_available_child_of_node, of_get_next_available_child
Macro for_each_child_of_node() makes it easy to iterate over all of the children for a given device tree node, including those nodes that are marked as unavailable (i.e. status = "disabled"). Introduce for_each_available_child_of_node(), which is like for_each_child_of_node(), but it automatically skips unavailable nodes. This also requires the introduction of helper function of_get_next_available_child(), which returns the next available child node. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/of.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 5919ee33f2b7..1b1163225f3b 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -190,10 +190,17 @@ extern struct device_node *of_get_parent(const struct device_node *node);
190extern struct device_node *of_get_next_parent(struct device_node *node); 190extern struct device_node *of_get_next_parent(struct device_node *node);
191extern struct device_node *of_get_next_child(const struct device_node *node, 191extern struct device_node *of_get_next_child(const struct device_node *node,
192 struct device_node *prev); 192 struct device_node *prev);
193extern struct device_node *of_get_next_available_child(
194 const struct device_node *node, struct device_node *prev);
195
193#define for_each_child_of_node(parent, child) \ 196#define for_each_child_of_node(parent, child) \
194 for (child = of_get_next_child(parent, NULL); child != NULL; \ 197 for (child = of_get_next_child(parent, NULL); child != NULL; \
195 child = of_get_next_child(parent, child)) 198 child = of_get_next_child(parent, child))
196 199
200#define for_each_available_child_of_node(parent, child) \
201 for (child = of_get_next_available_child(parent, NULL); child != NULL; \
202 child = of_get_next_available_child(parent, child))
203
197static inline int of_get_child_count(const struct device_node *np) 204static inline int of_get_child_count(const struct device_node *np)
198{ 205{
199 struct device_node *child; 206 struct device_node *child;