diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-04-24 17:16:16 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-07-20 13:32:58 +1000 |
commit | e679c5f445fe142940e0962de9c5c82f10d9357c (patch) | |
tree | 997daf76cc643fdc495ce0a667cfdc5b1c9515ab /drivers | |
parent | 581b605a83ec241a2aff8ef780e08b9414c8dfd8 (diff) | |
download | kernel_samsung_crespo-e679c5f445fe142940e0962de9c5c82f10d9357c.zip kernel_samsung_crespo-e679c5f445fe142940e0962de9c5c82f10d9357c.tar.gz kernel_samsung_crespo-e679c5f445fe142940e0962de9c5c82f10d9357c.tar.bz2 |
Consolidate of_get_parent
This requires creating dummy of_node_{get,put} routines for sparc and
sparc64. It also adds a read_lock around the parent accesses.
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 'drivers')
-rw-r--r-- | drivers/of/base.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index 70b6084..82bb786 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -113,3 +113,24 @@ int of_device_is_compatible(const struct device_node *device, return 0; } EXPORT_SYMBOL(of_device_is_compatible); + +/** + * of_get_parent - Get a node's parent if any + * @node: Node to get parent + * + * Returns a node pointer with refcount incremented, use + * of_node_put() on it when done. + */ +struct device_node *of_get_parent(const struct device_node *node) +{ + struct device_node *np; + + if (!node) + return NULL; + + read_lock(&devtree_lock); + np = of_node_get(node->parent); + read_unlock(&devtree_lock); + return np; +} +EXPORT_SYMBOL(of_get_parent); |