aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
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/powerpc/kernel
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/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/prom.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 1ed2ec2ea05b..f954c718d7eb 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -817,65 +817,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
817 return NULL; 817 return NULL;
818} 818}
819 819
820/*
821 * Plug a device node into the tree and global list.
822 */
823void of_attach_node(struct device_node *np)
824{
825 unsigned long flags;
826
827 write_lock_irqsave(&devtree_lock, flags);
828 np->sibling = np->parent->child;
829 np->allnext = allnodes;
830 np->parent->child = np;
831 allnodes = np;
832 write_unlock_irqrestore(&devtree_lock, flags);
833}
834
835/*
836 * "Unplug" a node from the device tree. The caller must hold
837 * a reference to the node. The memory associated with the node
838 * is not freed until its refcount goes to zero.
839 */
840void of_detach_node(struct device_node *np)
841{
842 struct device_node *parent;
843 unsigned long flags;
844
845 write_lock_irqsave(&devtree_lock, flags);
846
847 parent = np->parent;
848 if (!parent)
849 goto out_unlock;
850
851 if (allnodes == np)
852 allnodes = np->allnext;
853 else {
854 struct device_node *prev;
855 for (prev = allnodes;
856 prev->allnext != np;
857 prev = prev->allnext)
858 ;
859 prev->allnext = np->allnext;
860 }
861
862 if (parent->child == np)
863 parent->child = np->sibling;
864 else {
865 struct device_node *prevsib;
866 for (prevsib = np->parent->child;
867 prevsib->sibling != np;
868 prevsib = prevsib->sibling)
869 ;
870 prevsib->sibling = np->sibling;
871 }
872
873 of_node_set_flag(np, OF_DETACHED);
874
875out_unlock:
876 write_unlock_irqrestore(&devtree_lock, flags);
877}
878
879#ifdef CONFIG_PPC_PSERIES 820#ifdef CONFIG_PPC_PSERIES
880/* 821/*
881 * Fix up the uninitialized fields in a new device node: 822 * Fix up the uninitialized fields in a new device node: