diff options
-rw-r--r-- | arch/powerpc/kernel/prom.c | 21 | ||||
-rw-r--r-- | arch/sparc/kernel/prom.c | 13 | ||||
-rw-r--r-- | arch/sparc64/kernel/prom.c | 13 | ||||
-rw-r--r-- | drivers/of/base.c | 21 | ||||
-rw-r--r-- | include/asm-sparc/prom.h | 9 | ||||
-rw-r--r-- | include/asm-sparc64/prom.h | 9 |
6 files changed, 39 insertions, 47 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 3f6238d96a5d..1ad56d3c6061 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -1241,27 +1241,6 @@ struct device_node *of_find_all_nodes(struct device_node *prev) | |||
1241 | EXPORT_SYMBOL(of_find_all_nodes); | 1241 | EXPORT_SYMBOL(of_find_all_nodes); |
1242 | 1242 | ||
1243 | /** | 1243 | /** |
1244 | * of_get_parent - Get a node's parent if any | ||
1245 | * @node: Node to get parent | ||
1246 | * | ||
1247 | * Returns a node pointer with refcount incremented, use | ||
1248 | * of_node_put() on it when done. | ||
1249 | */ | ||
1250 | struct device_node *of_get_parent(const struct device_node *node) | ||
1251 | { | ||
1252 | struct device_node *np; | ||
1253 | |||
1254 | if (!node) | ||
1255 | return NULL; | ||
1256 | |||
1257 | read_lock(&devtree_lock); | ||
1258 | np = of_node_get(node->parent); | ||
1259 | read_unlock(&devtree_lock); | ||
1260 | return np; | ||
1261 | } | ||
1262 | EXPORT_SYMBOL(of_get_parent); | ||
1263 | |||
1264 | /** | ||
1265 | * of_get_next_child - Iterate a node childs | 1244 | * of_get_next_child - Iterate a node childs |
1266 | * @node: parent node | 1245 | * @node: parent node |
1267 | * @prev: previous child of the parent node, or NULL to get first | 1246 | * @prev: previous child of the parent node, or NULL to get first |
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c index 0f5aab4326b3..b37871578087 100644 --- a/arch/sparc/kernel/prom.c +++ b/arch/sparc/kernel/prom.c | |||
@@ -29,19 +29,6 @@ static struct device_node *allnodes; | |||
29 | 29 | ||
30 | extern rwlock_t devtree_lock; /* temporary while merging */ | 30 | extern rwlock_t devtree_lock; /* temporary while merging */ |
31 | 31 | ||
32 | struct device_node *of_get_parent(const struct device_node *node) | ||
33 | { | ||
34 | struct device_node *np; | ||
35 | |||
36 | if (!node) | ||
37 | return NULL; | ||
38 | |||
39 | np = node->parent; | ||
40 | |||
41 | return np; | ||
42 | } | ||
43 | EXPORT_SYMBOL(of_get_parent); | ||
44 | |||
45 | struct device_node *of_get_next_child(const struct device_node *node, | 32 | struct device_node *of_get_next_child(const struct device_node *node, |
46 | struct device_node *prev) | 33 | struct device_node *prev) |
47 | { | 34 | { |
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c index a1ccc00c7958..2462731ac1a3 100644 --- a/arch/sparc64/kernel/prom.c +++ b/arch/sparc64/kernel/prom.c | |||
@@ -34,19 +34,6 @@ static struct device_node *allnodes; | |||
34 | 34 | ||
35 | extern rwlock_t devtree_lock; /* temporary while merging */ | 35 | extern rwlock_t devtree_lock; /* temporary while merging */ |
36 | 36 | ||
37 | struct device_node *of_get_parent(const struct device_node *node) | ||
38 | { | ||
39 | struct device_node *np; | ||
40 | |||
41 | if (!node) | ||
42 | return NULL; | ||
43 | |||
44 | np = node->parent; | ||
45 | |||
46 | return np; | ||
47 | } | ||
48 | EXPORT_SYMBOL(of_get_parent); | ||
49 | |||
50 | struct device_node *of_get_next_child(const struct device_node *node, | 37 | struct device_node *of_get_next_child(const struct device_node *node, |
51 | struct device_node *prev) | 38 | struct device_node *prev) |
52 | { | 39 | { |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 70b60845140e..82bb78680ff6 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, | |||
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
115 | EXPORT_SYMBOL(of_device_is_compatible); | 115 | EXPORT_SYMBOL(of_device_is_compatible); |
116 | |||
117 | /** | ||
118 | * of_get_parent - Get a node's parent if any | ||
119 | * @node: Node to get parent | ||
120 | * | ||
121 | * Returns a node pointer with refcount incremented, use | ||
122 | * of_node_put() on it when done. | ||
123 | */ | ||
124 | struct device_node *of_get_parent(const struct device_node *node) | ||
125 | { | ||
126 | struct device_node *np; | ||
127 | |||
128 | if (!node) | ||
129 | return NULL; | ||
130 | |||
131 | read_lock(&devtree_lock); | ||
132 | np = of_node_get(node->parent); | ||
133 | read_unlock(&devtree_lock); | ||
134 | return np; | ||
135 | } | ||
136 | EXPORT_SYMBOL(of_get_parent); | ||
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h index 57f86c84293b..c7d54958a90e 100644 --- a/include/asm-sparc/prom.h +++ b/include/asm-sparc/prom.h | |||
@@ -69,6 +69,15 @@ extern int of_getintprop_default(struct device_node *np, | |||
69 | 69 | ||
70 | extern void prom_build_devicetree(void); | 70 | extern void prom_build_devicetree(void); |
71 | 71 | ||
72 | /* Dummy ref counting routines - to be implemented later */ | ||
73 | static inline struct device_node *of_node_get(struct device_node *node) | ||
74 | { | ||
75 | return node; | ||
76 | } | ||
77 | static inline void of_node_put(struct device_node *node) | ||
78 | { | ||
79 | } | ||
80 | |||
72 | /* | 81 | /* |
73 | * NB: This is here while we transition from using asm/prom.h | 82 | * NB: This is here while we transition from using asm/prom.h |
74 | * to linux/of.h | 83 | * to linux/of.h |
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h index 6a5e2405cbf4..e83896f3c141 100644 --- a/include/asm-sparc64/prom.h +++ b/include/asm-sparc64/prom.h | |||
@@ -78,6 +78,15 @@ extern int of_getintprop_default(struct device_node *np, | |||
78 | 78 | ||
79 | extern void prom_build_devicetree(void); | 79 | extern void prom_build_devicetree(void); |
80 | 80 | ||
81 | /* Dummy ref counting routines - to be implemented later */ | ||
82 | static inline struct device_node *of_node_get(struct device_node *node) | ||
83 | { | ||
84 | return node; | ||
85 | } | ||
86 | static inline void of_node_put(struct device_node *node) | ||
87 | { | ||
88 | } | ||
89 | |||
81 | /* | 90 | /* |
82 | * NB: This is here while we transition from using asm/prom.h | 91 | * NB: This is here while we transition from using asm/prom.h |
83 | * to linux/of.h | 92 | * to linux/of.h |