diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-04-24 03:21:29 -0400 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-07-19 23:34:26 -0400 |
commit | d1cd355a5e44dfe993efc0c0458ca9f99a28a9a3 (patch) | |
tree | 9bcc28338f70b8c3c5076f2dbf0a8d3ce551f0b8 /arch/powerpc/kernel/prom.c | |
parent | e679c5f445fe142940e0962de9c5c82f10d9357c (diff) |
Consolidate of_get_next_child
This adds a read_lock around the child/next accesses on Sparc.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
-rw-r--r-- | arch/powerpc/kernel/prom.c | 24 |
1 files changed, 0 insertions, 24 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 |