diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2009-11-10 15:57:55 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2009-11-10 15:57:55 +1100 |
commit | 2f2bf83e05eb9e294cd88c6fd57678c349f0a974 (patch) | |
tree | b30dc98950e081889e4e9b485d03c64a16556d2b /drivers/of | |
parent | 720fc38b055070872a724a16b58cae8a5e537520 (diff) | |
parent | e91edcf5a2940bb7f1f316c871dfe9e2aaf9d6d9 (diff) |
Merge remote branch 'devicetree/next-devicetree'
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/base.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index ddf224d456b2..e6627b2320f1 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -9,7 +9,8 @@ * * Adapted for sparc and sparc64 by David S. Miller davem@davemloft.net * - * Reconsolidated from arch/x/kernel/prom.c by Stephen Rothwell. + * Reconsolidated from arch/x/kernel/prom.c by Stephen Rothwell and + * Grant Likely. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -82,6 +83,29 @@ struct property *of_find_property(const struct device_node *np, } EXPORT_SYMBOL(of_find_property); +/** + * of_find_all_nodes - Get next node in global list + * @prev: Previous node or NULL to start iteration + * of_node_put() will be called on it + * + * Returns a node pointer with refcount incremented, use + * of_node_put() on it when done. + */ +struct device_node *of_find_all_nodes(struct device_node *prev) +{ + struct device_node *np; + + read_lock(&devtree_lock); + np = prev ? prev->allnext : allnodes; + for (; np != NULL; np = np->allnext) + if (of_node_get(np)) + break; + of_node_put(prev); + read_unlock(&devtree_lock); + return np; +} +EXPORT_SYMBOL(of_find_all_nodes); + /* * Find a property with a given name for a given node * and return the value. |