diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-05 08:05:11 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-05 08:05:11 -0400 |
commit | 75d8f2931a803b803cb4a850448460475c20f30b (patch) | |
tree | 9853b9084fa55609c8e4abbc1763bc500e05da50 /drivers/of/base.c | |
parent | ffb690d5aa36d38d7bed7579e3f07b84ff6b3a08 (diff) | |
parent | e93c7d1bc350189511d32cec2f0af79c30e7fa47 (diff) |
Merge branch 'asoc-omap' into for-3.7
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r-- | drivers/of/base.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index c181b94abc36..d4a1c9a043e1 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -364,6 +364,33 @@ struct device_node *of_get_next_child(const struct device_node *node, | |||
364 | EXPORT_SYMBOL(of_get_next_child); | 364 | EXPORT_SYMBOL(of_get_next_child); |
365 | 365 | ||
366 | /** | 366 | /** |
367 | * of_get_next_available_child - Find the next available child node | ||
368 | * @node: parent node | ||
369 | * @prev: previous child of the parent node, or NULL to get first | ||
370 | * | ||
371 | * This function is like of_get_next_child(), except that it | ||
372 | * automatically skips any disabled nodes (i.e. status = "disabled"). | ||
373 | */ | ||
374 | struct device_node *of_get_next_available_child(const struct device_node *node, | ||
375 | struct device_node *prev) | ||
376 | { | ||
377 | struct device_node *next; | ||
378 | |||
379 | read_lock(&devtree_lock); | ||
380 | next = prev ? prev->sibling : node->child; | ||
381 | for (; next; next = next->sibling) { | ||
382 | if (!of_device_is_available(next)) | ||
383 | continue; | ||
384 | if (of_node_get(next)) | ||
385 | break; | ||
386 | } | ||
387 | of_node_put(prev); | ||
388 | read_unlock(&devtree_lock); | ||
389 | return next; | ||
390 | } | ||
391 | EXPORT_SYMBOL(of_get_next_available_child); | ||
392 | |||
393 | /** | ||
367 | * of_find_node_by_path - Find a node matching a full OF path | 394 | * of_find_node_by_path - Find a node matching a full OF path |
368 | * @path: The full path to match | 395 | * @path: The full path to match |
369 | * | 396 | * |