diff options
-rw-r--r-- | arch/powerpc/kernel/prom.c | 24 | ||||
-rw-r--r-- | arch/sparc/kernel/prom.c | 14 | ||||
-rw-r--r-- | arch/sparc64/kernel/prom.c | 14 | ||||
-rw-r--r-- | drivers/of/base.c | 24 |
4 files changed, 24 insertions, 52 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 1ad56d3c6061..5fa221ce8714 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -1241,30 +1241,6 @@ struct device_node *of_find_all_nodes(struct device_node *prev) | |||
1241 | EXPORT_SYMBOL(of_find_all_nodes); | 1241 | EXPORT_SYMBOL(of_find_all_nodes); |
1242 | 1242 | ||
1243 | /** | 1243 | /** |
1244 | * of_get_next_child - Iterate a node childs | ||
1245 | * @node: parent node | ||
1246 | * @prev: previous child of the parent node, or NULL to get first | ||
1247 | * | ||
1248 | * Returns a node pointer with refcount incremented, use | ||
1249 | * of_node_put() on it when done. | ||
1250 | */ | ||
1251 | struct device_node *of_get_next_child(const struct device_node *node, | ||
1252 | struct device_node *prev) | ||
1253 | { | ||
1254 | struct device_node *next; | ||
1255 | |||
1256 | read_lock(&devtree_lock); | ||
1257 | next = prev ? prev->sibling : node->child; | ||
1258 | for (; next != 0; next = next->sibling) | ||
1259 | if (of_node_get(next)) | ||
1260 | break; | ||
1261 | of_node_put(prev); | ||
1262 | read_unlock(&devtree_lock); | ||
1263 | return next; | ||
1264 | } | ||
1265 | EXPORT_SYMBOL(of_get_next_child); | ||
1266 | |||
1267 | /** | ||
1268 | * of_node_get - Increment refcount of a node | 1244 | * of_node_get - Increment refcount of a node |
1269 | * @node: Node to inc refcount, NULL is supported to | 1245 | * @node: Node to inc refcount, NULL is supported to |
1270 | * simplify writing of callers | 1246 | * simplify writing of callers |
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c index b37871578087..3f8ccfad2e01 100644 --- a/arch/sparc/kernel/prom.c +++ b/arch/sparc/kernel/prom.c | |||
@@ -29,20 +29,6 @@ static struct device_node *allnodes; | |||
29 | 29 | ||
30 | extern rwlock_t devtree_lock; /* temporary while merging */ | 30 | extern rwlock_t devtree_lock; /* temporary while merging */ |
31 | 31 | ||
32 | struct device_node *of_get_next_child(const struct device_node *node, | ||
33 | struct device_node *prev) | ||
34 | { | ||
35 | struct device_node *next; | ||
36 | |||
37 | next = prev ? prev->sibling : node->child; | ||
38 | for (; next != 0; next = next->sibling) { | ||
39 | break; | ||
40 | } | ||
41 | |||
42 | return next; | ||
43 | } | ||
44 | EXPORT_SYMBOL(of_get_next_child); | ||
45 | |||
46 | struct device_node *of_find_node_by_path(const char *path) | 32 | struct device_node *of_find_node_by_path(const char *path) |
47 | { | 33 | { |
48 | struct device_node *np = allnodes; | 34 | struct device_node *np = allnodes; |
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c index 2462731ac1a3..ee96ef61bc99 100644 --- a/arch/sparc64/kernel/prom.c +++ b/arch/sparc64/kernel/prom.c | |||
@@ -34,20 +34,6 @@ static struct device_node *allnodes; | |||
34 | 34 | ||
35 | extern rwlock_t devtree_lock; /* temporary while merging */ | 35 | extern rwlock_t devtree_lock; /* temporary while merging */ |
36 | 36 | ||
37 | struct device_node *of_get_next_child(const struct device_node *node, | ||
38 | struct device_node *prev) | ||
39 | { | ||
40 | struct device_node *next; | ||
41 | |||
42 | next = prev ? prev->sibling : node->child; | ||
43 | for (; next != 0; next = next->sibling) { | ||
44 | break; | ||
45 | } | ||
46 | |||
47 | return next; | ||
48 | } | ||
49 | EXPORT_SYMBOL(of_get_next_child); | ||
50 | |||
51 | struct device_node *of_find_node_by_path(const char *path) | 37 | struct device_node *of_find_node_by_path(const char *path) |
52 | { | 38 | { |
53 | struct device_node *np = allnodes; | 39 | struct device_node *np = allnodes; |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 82bb78680ff6..6b6dfcc56522 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -134,3 +134,27 @@ struct device_node *of_get_parent(const struct device_node *node) | |||
134 | return np; | 134 | return np; |
135 | } | 135 | } |
136 | EXPORT_SYMBOL(of_get_parent); | 136 | EXPORT_SYMBOL(of_get_parent); |
137 | |||
138 | /** | ||
139 | * of_get_next_child - Iterate a node childs | ||
140 | * @node: parent node | ||
141 | * @prev: previous child of the parent node, or NULL to get first | ||
142 | * | ||
143 | * Returns a node pointer with refcount incremented, use | ||
144 | * of_node_put() on it when done. | ||
145 | */ | ||
146 | struct device_node *of_get_next_child(const struct device_node *node, | ||
147 | struct device_node *prev) | ||
148 | { | ||
149 | struct device_node *next; | ||
150 | |||
151 | read_lock(&devtree_lock); | ||
152 | next = prev ? prev->sibling : node->child; | ||
153 | for (; next; next = next->sibling) | ||
154 | if (of_node_get(next)) | ||
155 | break; | ||
156 | of_node_put(prev); | ||
157 | read_unlock(&devtree_lock); | ||
158 | return next; | ||
159 | } | ||
160 | EXPORT_SYMBOL(of_get_next_child); | ||