diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-01-29 07:04:33 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-02-09 10:32:42 -0500 |
commit | fcdeb7fedf89f4bbc2e11959794968080cd8426e (patch) | |
tree | b549ce78d381f6185d10395afdea9ce8f741fd40 /arch/microblaze | |
parent | 580537140568caddbc8a727d4c2f238d38707f68 (diff) |
of: merge of_attach_node() & of_detach_node()
Merge common code between PowerPC and Microblaze
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/microblaze')
-rw-r--r-- | arch/microblaze/include/asm/prom.h | 4 | ||||
-rw-r--r-- | arch/microblaze/kernel/prom.c | 59 |
2 files changed, 0 insertions, 63 deletions
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h index 07d1063f9aae..6c6b386cf3c6 100644 --- a/arch/microblaze/include/asm/prom.h +++ b/arch/microblaze/include/asm/prom.h | |||
@@ -39,10 +39,6 @@ extern struct device_node *of_chosen; | |||
39 | 39 | ||
40 | extern rwlock_t devtree_lock; /* temporary while merging */ | 40 | extern rwlock_t devtree_lock; /* temporary while merging */ |
41 | 41 | ||
42 | /* For updating the device tree at runtime */ | ||
43 | extern void of_attach_node(struct device_node *); | ||
44 | extern void of_detach_node(struct device_node *); | ||
45 | |||
46 | /* Other Prototypes */ | 42 | /* Other Prototypes */ |
47 | extern int early_uartlite_console(void); | 43 | extern int early_uartlite_console(void); |
48 | 44 | ||
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c index cd158ef5b583..8171282a0b0d 100644 --- a/arch/microblaze/kernel/prom.c +++ b/arch/microblaze/kernel/prom.c | |||
@@ -197,65 +197,6 @@ struct device_node *of_find_node_by_phandle(phandle handle) | |||
197 | } | 197 | } |
198 | EXPORT_SYMBOL(of_find_node_by_phandle); | 198 | EXPORT_SYMBOL(of_find_node_by_phandle); |
199 | 199 | ||
200 | /* | ||
201 | * Plug a device node into the tree and global list. | ||
202 | */ | ||
203 | void of_attach_node(struct device_node *np) | ||
204 | { | ||
205 | unsigned long flags; | ||
206 | |||
207 | write_lock_irqsave(&devtree_lock, flags); | ||
208 | np->sibling = np->parent->child; | ||
209 | np->allnext = allnodes; | ||
210 | np->parent->child = np; | ||
211 | allnodes = np; | ||
212 | write_unlock_irqrestore(&devtree_lock, flags); | ||
213 | } | ||
214 | |||
215 | /* | ||
216 | * "Unplug" a node from the device tree. The caller must hold | ||
217 | * a reference to the node. The memory associated with the node | ||
218 | * is not freed until its refcount goes to zero. | ||
219 | */ | ||
220 | void of_detach_node(struct device_node *np) | ||
221 | { | ||
222 | struct device_node *parent; | ||
223 | unsigned long flags; | ||
224 | |||
225 | write_lock_irqsave(&devtree_lock, flags); | ||
226 | |||
227 | parent = np->parent; | ||
228 | if (!parent) | ||
229 | goto out_unlock; | ||
230 | |||
231 | if (allnodes == np) | ||
232 | allnodes = np->allnext; | ||
233 | else { | ||
234 | struct device_node *prev; | ||
235 | for (prev = allnodes; | ||
236 | prev->allnext != np; | ||
237 | prev = prev->allnext) | ||
238 | ; | ||
239 | prev->allnext = np->allnext; | ||
240 | } | ||
241 | |||
242 | if (parent->child == np) | ||
243 | parent->child = np->sibling; | ||
244 | else { | ||
245 | struct device_node *prevsib; | ||
246 | for (prevsib = np->parent->child; | ||
247 | prevsib->sibling != np; | ||
248 | prevsib = prevsib->sibling) | ||
249 | ; | ||
250 | prevsib->sibling = np->sibling; | ||
251 | } | ||
252 | |||
253 | of_node_set_flag(np, OF_DETACHED); | ||
254 | |||
255 | out_unlock: | ||
256 | write_unlock_irqrestore(&devtree_lock, flags); | ||
257 | } | ||
258 | |||
259 | #if defined(CONFIG_DEBUG_FS) && defined(DEBUG) | 200 | #if defined(CONFIG_DEBUG_FS) && defined(DEBUG) |
260 | static struct debugfs_blob_wrapper flat_dt_blob; | 201 | static struct debugfs_blob_wrapper flat_dt_blob; |
261 | 202 | ||