diff options
author | Christoph Hellwig <hch@lst.de> | 2006-03-08 16:47:00 +0100 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-03-17 13:21:09 +1100 |
commit | e33852228f74b8ccbed8595083bb725b70902ed7 (patch) | |
tree | a73484a589b2d2f20d82f591d823b98a021cd4b1 | |
parent | d116fe5aeafd8226712d2de9c69428725ca74474 (diff) | |
download | kernel_samsung_smdk4412-e33852228f74b8ccbed8595083bb725b70902ed7.zip kernel_samsung_smdk4412-e33852228f74b8ccbed8595083bb725b70902ed7.tar.gz kernel_samsung_smdk4412-e33852228f74b8ccbed8595083bb725b70902ed7.tar.bz2 |
[PATCH] powerpc: add for_each_node_by_foo helpers
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>
-rw-r--r-- | include/asm-powerpc/prom.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h index cbd297f..782e13a 100644 --- a/include/asm-powerpc/prom.h +++ b/include/asm-powerpc/prom.h @@ -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); |