]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] powerpc: add for_each_node_by_foo helpers
authorChristoph Hellwig <hch@lst.de>
Wed, 8 Mar 2006 15:47:00 +0000 (16:47 +0100)
committerPaul Mackerras <paulus@samba.org>
Fri, 17 Mar 2006 02:21:09 +0000 (13:21 +1100)
Typical use for of_find_node_by_name and of_find_node_by_type is to
iterate over all nodes of a given type/name.  Add a helper macro to
do that (in spirit of the list_for_each* macros).

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
include/asm-powerpc/prom.h

index cbd297f44cce6490ac1220898a945d58c95158aa..782e13a070a11ca7fe269b20d148b580db530abf 100644 (file)
@@ -126,8 +126,14 @@ extern struct device_node *find_all_nodes(void);
 /* New style node lookup */
 extern struct device_node *of_find_node_by_name(struct device_node *from,
        const char *name);
+#define for_each_node_by_name(dn, name) \
+       for (dn = of_find_node_by_name(NULL, name); dn; \
+            dn = of_find_node_by_name(dn, name))
 extern struct device_node *of_find_node_by_type(struct device_node *from,
        const char *type);
+#define for_each_node_by_type(dn, type) \
+       for (dn = of_find_node_by_type(NULL, type); dn; \
+            dn = of_find_node_by_type(dn, type))
 extern struct device_node *of_find_compatible_node(struct device_node *from,
        const char *type, const char *compat);
 extern struct device_node *of_find_node_by_path(const char *path);