mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 15:11:16 +00:00
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>
This commit is contained in:
parent
581b605a83
commit
e679c5f445
6 changed files with 39 additions and 47 deletions
|
@ -1240,27 +1240,6 @@ struct device_node *of_find_all_nodes(struct device_node *prev)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(of_find_all_nodes);
|
EXPORT_SYMBOL(of_find_all_nodes);
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* of_get_next_child - Iterate a node childs
|
* of_get_next_child - Iterate a node childs
|
||||||
* @node: parent node
|
* @node: parent node
|
||||||
|
|
|
@ -29,19 +29,6 @@ static struct device_node *allnodes;
|
||||||
|
|
||||||
extern rwlock_t devtree_lock; /* temporary while merging */
|
extern rwlock_t devtree_lock; /* temporary while merging */
|
||||||
|
|
||||||
struct device_node *of_get_parent(const struct device_node *node)
|
|
||||||
{
|
|
||||||
struct device_node *np;
|
|
||||||
|
|
||||||
if (!node)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
np = node->parent;
|
|
||||||
|
|
||||||
return np;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(of_get_parent);
|
|
||||||
|
|
||||||
struct device_node *of_get_next_child(const struct device_node *node,
|
struct device_node *of_get_next_child(const struct device_node *node,
|
||||||
struct device_node *prev)
|
struct device_node *prev)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,19 +34,6 @@ static struct device_node *allnodes;
|
||||||
|
|
||||||
extern rwlock_t devtree_lock; /* temporary while merging */
|
extern rwlock_t devtree_lock; /* temporary while merging */
|
||||||
|
|
||||||
struct device_node *of_get_parent(const struct device_node *node)
|
|
||||||
{
|
|
||||||
struct device_node *np;
|
|
||||||
|
|
||||||
if (!node)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
np = node->parent;
|
|
||||||
|
|
||||||
return np;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(of_get_parent);
|
|
||||||
|
|
||||||
struct device_node *of_get_next_child(const struct device_node *node,
|
struct device_node *of_get_next_child(const struct device_node *node,
|
||||||
struct device_node *prev)
|
struct device_node *prev)
|
||||||
{
|
{
|
||||||
|
|
|
@ -113,3 +113,24 @@ int of_device_is_compatible(const struct device_node *device,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(of_device_is_compatible);
|
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);
|
||||||
|
|
|
@ -69,6 +69,15 @@ extern int of_getintprop_default(struct device_node *np,
|
||||||
|
|
||||||
extern void prom_build_devicetree(void);
|
extern void prom_build_devicetree(void);
|
||||||
|
|
||||||
|
/* Dummy ref counting routines - to be implemented later */
|
||||||
|
static inline struct device_node *of_node_get(struct device_node *node)
|
||||||
|
{
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
static inline void of_node_put(struct device_node *node)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NB: This is here while we transition from using asm/prom.h
|
* NB: This is here while we transition from using asm/prom.h
|
||||||
* to linux/of.h
|
* to linux/of.h
|
||||||
|
|
|
@ -78,6 +78,15 @@ extern int of_getintprop_default(struct device_node *np,
|
||||||
|
|
||||||
extern void prom_build_devicetree(void);
|
extern void prom_build_devicetree(void);
|
||||||
|
|
||||||
|
/* Dummy ref counting routines - to be implemented later */
|
||||||
|
static inline struct device_node *of_node_get(struct device_node *node)
|
||||||
|
{
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
static inline void of_node_put(struct device_node *node)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NB: This is here while we transition from using asm/prom.h
|
* NB: This is here while we transition from using asm/prom.h
|
||||||
* to linux/of.h
|
* to linux/of.h
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue