diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-06-21 19:33:54 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-24 02:15:04 -0400 |
commit | aaf7cec2769942035985716452107fc5ba0b11f6 (patch) | |
tree | 4f4bc5278ef41e016b97b6860d30fa773db7fee2 | |
parent | 372b07bb5a13f8a1b8a3ce49cd76d39a79dbd3bd (diff) |
[SPARC64]: Add of_find_node_by_{name,type}().
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc64/kernel/prom.c | 26 | ||||
-rw-r--r-- | include/asm-sparc64/prom.h | 10 |
2 files changed, 36 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c index c99b7aae19df..fd46e94ce06b 100644 --- a/arch/sparc64/kernel/prom.c +++ b/arch/sparc64/kernel/prom.c | |||
@@ -63,6 +63,32 @@ struct device_node *of_find_node_by_path(const char *path) | |||
63 | return np; | 63 | return np; |
64 | } | 64 | } |
65 | 65 | ||
66 | struct device_node *of_find_node_by_name(struct device_node *from, | ||
67 | const char *name) | ||
68 | { | ||
69 | struct device_node *np; | ||
70 | |||
71 | np = from ? from->allnext : allnodes; | ||
72 | for (; np != NULL; np = np->allnext) | ||
73 | if (np->name != NULL && strcmp(np->name, name) == 0) | ||
74 | break; | ||
75 | |||
76 | return np; | ||
77 | } | ||
78 | |||
79 | struct device_node *of_find_node_by_type(struct device_node *from, | ||
80 | const char *type) | ||
81 | { | ||
82 | struct device_node *np; | ||
83 | |||
84 | np = from ? from->allnext : allnodes; | ||
85 | for (; np != 0; np = np->allnext) | ||
86 | if (np->type != 0 && strcmp(np->type, type) == 0) | ||
87 | break; | ||
88 | |||
89 | return np; | ||
90 | } | ||
91 | |||
66 | struct property *of_find_property(struct device_node *np, const char *name, | 92 | struct property *of_find_property(struct device_node *np, const char *name, |
67 | int *lenp) | 93 | int *lenp) |
68 | { | 94 | { |
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h index 44bcc83267f3..eb75d3cbcf4c 100644 --- a/include/asm-sparc64/prom.h +++ b/include/asm-sparc64/prom.h | |||
@@ -65,6 +65,16 @@ static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_e | |||
65 | dn->pde = de; | 65 | dn->pde = de; |
66 | } | 66 | } |
67 | 67 | ||
68 | extern struct device_node *of_find_node_by_name(struct device_node *from, | ||
69 | const char *name); | ||
70 | #define for_each_node_by_name(dn, name) \ | ||
71 | for (dn = of_find_node_by_name(NULL, name); dn; \ | ||
72 | dn = of_find_node_by_name(dn, name)) | ||
73 | extern struct device_node *of_find_node_by_type(struct device_node *from, | ||
74 | const char *type); | ||
75 | #define for_each_node_by_type(dn, type) \ | ||
76 | for (dn = of_find_node_by_type(NULL, type); dn; \ | ||
77 | dn = of_find_node_by_type(dn, type)) | ||
68 | extern struct device_node *of_find_node_by_path(const char *path); | 78 | extern struct device_node *of_find_node_by_path(const char *path); |
69 | extern struct device_node *of_get_parent(const struct device_node *node); | 79 | extern struct device_node *of_get_parent(const struct device_node *node); |
70 | extern struct device_node *of_get_next_child(const struct device_node *node, | 80 | extern struct device_node *of_get_next_child(const struct device_node *node, |