aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-01-29 07:04:33 -0500
committerGrant Likely <grant.likely@secretlab.ca>2010-02-09 10:32:42 -0500
commitfcdeb7fedf89f4bbc2e11959794968080cd8426e (patch)
treeb549ce78d381f6185d10395afdea9ce8f741fd40 /arch/microblaze
parent580537140568caddbc8a727d4c2f238d38707f68 (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.h4
-rw-r--r--arch/microblaze/kernel/prom.c59
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
40extern rwlock_t devtree_lock; /* temporary while merging */ 40extern rwlock_t devtree_lock; /* temporary while merging */
41 41
42/* For updating the device tree at runtime */
43extern void of_attach_node(struct device_node *);
44extern void of_detach_node(struct device_node *);
45
46/* Other Prototypes */ 42/* Other Prototypes */
47extern int early_uartlite_console(void); 43extern 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}
198EXPORT_SYMBOL(of_find_node_by_phandle); 198EXPORT_SYMBOL(of_find_node_by_phandle);
199 199
200/*
201 * Plug a device node into the tree and global list.
202 */
203void 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 */
220void 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
255out_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)
260static struct debugfs_blob_wrapper flat_dt_blob; 201static struct debugfs_blob_wrapper flat_dt_blob;
261 202