diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-12-15 10:29:06 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-12-15 10:29:06 +0100 |
commit | 709334c87dbdb44150ce436b3d13c814db0dcae9 (patch) | |
tree | 5861a45f70c1f283720337abd864498f5afb3dbe /drivers/of/base.c | |
parent | 0d64b568fcd48b133721c1d322e7c51d85eb12df (diff) | |
parent | f74890277a196949e4004fe2955e1d4fb3930f98 (diff) |
Merge branch 'fixes' of git://git.alsa-project.org/alsa-kernel into for-linus
Diffstat (limited to 'drivers/of/base.c')
-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 ddf224d456b..e6627b2320f 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. |