diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2007-11-26 03:03:45 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-12-10 21:34:39 -0500 |
commit | aabc08dc662b7acb17ca5706533253ce10c050b1 (patch) | |
tree | d4cc522f5eedeaffc465f7c3e26de8b809c7abcf /include/linux/of.h | |
parent | 18cce5d321cf01413f416d7fe9fb00404cba04fd (diff) |
[POWERPC] Add for_each_child_of_node() helper for iterating over child nodes
Add for_each_child_of_node() to encapsulate the common idiom of
iterating over the children of a device_node.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r-- | include/linux/of.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 5c39b9270ff7..c65af7bd1e9c 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -46,6 +46,10 @@ extern struct device_node *of_find_node_by_phandle(phandle handle); | |||
46 | extern struct device_node *of_get_parent(const struct device_node *node); | 46 | extern struct device_node *of_get_parent(const struct device_node *node); |
47 | extern struct device_node *of_get_next_child(const struct device_node *node, | 47 | extern struct device_node *of_get_next_child(const struct device_node *node, |
48 | struct device_node *prev); | 48 | struct device_node *prev); |
49 | #define for_each_child_of_node(parent, child) \ | ||
50 | for (child = of_get_next_child(parent, NULL); child != NULL; \ | ||
51 | child = of_get_next_child(parent, child)) | ||
52 | |||
49 | extern struct property *of_find_property(const struct device_node *np, | 53 | extern struct property *of_find_property(const struct device_node *np, |
50 | const char *name, | 54 | const char *name, |
51 | int *lenp); | 55 | int *lenp); |