All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Fontenot <nfont-V7BBcbaFuwjMbYB6QlFGEg@public.gmane.org>
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ@public.gmane.org
Subject: Re: [PATCH 2/4] Merge of_detach_node
Date: Wed, 18 Nov 2009 15:45:52 -0600	[thread overview]
Message-ID: <4B046B10.3040101@austin.ibm.com> (raw)
In-Reply-To: <4B03620C.2060105-V7BBcbaFuwjMbYB6QlFGEg@public.gmane.org>

Merge the common of_detach_node() from powerpc and microblaze into the common
drivers/of/of_dynamic.c

Updated patch that should apply cleanly to test-devicetree, now with diffstat
output.

Signed-off-by: Nathan Fontenot <nfont-V7BBcbaFuwjMbYB6QlFGEg@public.gmane.org>
---
 arch/microblaze/kernel/prom.c |   44 ------------------------------------------
 arch/powerpc/kernel/prom.c    |   44 ------------------------------------------
 drivers/of/of_dynamic.c       |   43 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 88 deletions(-)

Index: test-devicetree/arch/microblaze/kernel/prom.c
===================================================================
--- test-devicetree.orig/arch/microblaze/kernel/prom.c	2009-11-18 19:21:31.000000000 -0600
+++ test-devicetree/arch/microblaze/kernel/prom.c	2009-11-18 19:23:04.000000000 -0600
@@ -482,50 +482,6 @@
 }
 EXPORT_SYMBOL(of_node_put);
 
-/*
- * "Unplug" a node from the device tree.  The caller must hold
- * a reference to the node.  The memory associated with the node
- * is not freed until its refcount goes to zero.
- */
-void of_detach_node(struct device_node *np)
-{
-	struct device_node *parent;
-	unsigned long flags;
-
-	write_lock_irqsave(&devtree_lock, flags);
-
-	parent = np->parent;
-	if (!parent)
-		goto out_unlock;
-
-	if (allnodes == np)
-		allnodes = np->allnext;
-	else {
-		struct device_node *prev;
-		for (prev = allnodes;
-		     prev->allnext != np;
-		     prev = prev->allnext)
-			;
-		prev->allnext = np->allnext;
-	}
-
-	if (parent->child == np)
-		parent->child = np->sibling;
-	else {
-		struct device_node *prevsib;
-		for (prevsib = np->parent->child;
-		     prevsib->sibling != np;
-		     prevsib = prevsib->sibling)
-			;
-		prevsib->sibling = np->sibling;
-	}
-
-	of_node_set_flag(np, OF_DETACHED);
-
-out_unlock:
-	write_unlock_irqrestore(&devtree_lock, flags);
-}
-
 #if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
 static struct debugfs_blob_wrapper flat_dt_blob;
 
Index: test-devicetree/arch/powerpc/kernel/prom.c
===================================================================
--- test-devicetree.orig/arch/powerpc/kernel/prom.c	2009-11-18 19:21:31.000000000 -0600
+++ test-devicetree/arch/powerpc/kernel/prom.c	2009-11-18 19:22:22.000000000 -0600
@@ -935,50 +935,6 @@
 }
 EXPORT_SYMBOL(of_node_put);
 
-/*
- * "Unplug" a node from the device tree.  The caller must hold
- * a reference to the node.  The memory associated with the node
- * is not freed until its refcount goes to zero.
- */
-void of_detach_node(struct device_node *np)
-{
-	struct device_node *parent;
-	unsigned long flags;
-
-	write_lock_irqsave(&devtree_lock, flags);
-
-	parent = np->parent;
-	if (!parent)
-		goto out_unlock;
-
-	if (allnodes == np)
-		allnodes = np->allnext;
-	else {
-		struct device_node *prev;
-		for (prev = allnodes;
-		     prev->allnext != np;
-		     prev = prev->allnext)
-			;
-		prev->allnext = np->allnext;
-	}
-
-	if (parent->child == np)
-		parent->child = np->sibling;
-	else {
-		struct device_node *prevsib;
-		for (prevsib = np->parent->child;
-		     prevsib->sibling != np;
-		     prevsib = prevsib->sibling)
-			;
-		prevsib->sibling = np->sibling;
-	}
-
-	of_node_set_flag(np, OF_DETACHED);
-
-out_unlock:
-	write_unlock_irqrestore(&devtree_lock, flags);
-}
-
 #ifdef CONFIG_PPC_PSERIES
 /*
  * Fix up the uninitialized fields in a new device node:
Index: test-devicetree/drivers/of/of_dynamic.c
===================================================================
--- test-devicetree.orig/drivers/of/of_dynamic.c	2009-11-18 19:21:31.000000000 -0600
+++ test-devicetree/drivers/of/of_dynamic.c	2009-11-18 19:22:22.000000000 -0600
@@ -34,3 +34,46 @@
 	write_unlock_irqrestore(&devtree_lock, flags);
 }
 
+/*
+ * "Unplug" a node from the device tree.  The caller must hold
+ * a reference to the node.  The memory associated with the node
+ * is not freed until its refcount goes to zero.
+ */
+void of_detach_node(struct device_node *np)
+{
+	struct device_node *parent;
+	unsigned long flags;
+
+	write_lock_irqsave(&devtree_lock, flags);
+
+	parent = np->parent;
+	if (!parent)
+		goto out_unlock;
+
+	if (allnodes == np)
+		allnodes = np->allnext;
+	else {
+		struct device_node *prev;
+		for (prev = allnodes;
+		     prev->allnext != np;
+		     prev = prev->allnext)
+			;
+		prev->allnext = np->allnext;
+	}
+
+	if (parent->child == np)
+		parent->child = np->sibling;
+	else {
+		struct device_node *prevsib;
+		for (prevsib = np->parent->child;
+		     prevsib->sibling != np;
+		     prevsib = prevsib->sibling)
+			;
+		prevsib->sibling = np->sibling;
+	}
+
+	of_node_set_flag(np, OF_DETACHED);
+
+out_unlock:
+	write_unlock_irqrestore(&devtree_lock, flags);
+}

  parent reply	other threads:[~2009-11-18 21:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-17 21:04 [PATCH 0/4] Merge OF dynamic patches Nathan Fontenot
2009-11-17 21:04 ` Nathan Fontenot
2009-11-18  2:53 ` [PATCH 1/4] Merge of_attach_node Nathan Fontenot
2009-11-18  2:53   ` Nathan Fontenot
     [not found]   ` <4B0361A9.20209-V7BBcbaFuwjMbYB6QlFGEg@public.gmane.org>
2009-11-18 21:44     ` Nathan Fontenot
2009-11-18  2:55 ` [PATCH 2/4] Merge of_detach_node Nathan Fontenot
     [not found]   ` <4B03620C.2060105-V7BBcbaFuwjMbYB6QlFGEg@public.gmane.org>
2009-11-18 21:45     ` Nathan Fontenot [this message]
2009-11-18  2:56 ` [PATCH 3/4] Makefile and Kconfig updates for of_dynamci Nathan Fontenot
     [not found]   ` <4B036256.9060809-V7BBcbaFuwjMbYB6QlFGEg@public.gmane.org>
2009-11-18 21:46     ` Nathan Fontenot
2009-11-18  2:57 ` [PATCH 4/4] Move of_node[attach,detach] declarations to linux/of.h Nathan Fontenot
     [not found]   ` <4B03629A.9050503-V7BBcbaFuwjMbYB6QlFGEg@public.gmane.org>
2009-11-18 21:48     ` [PATCH 4/4] Move of_node[attach, detach] " Nathan Fontenot
     [not found]       ` <4B046B92.3060108-V7BBcbaFuwjMbYB6QlFGEg@public.gmane.org>
2009-11-19  5:35         ` Andres Salomon
     [not found]           ` <20091119003517.677a5b02-d8A+jLeiQi/1Xlz9cAVuGNHuzzzSOjJt@public.gmane.org>
2009-11-19 20:32             ` Nathan Fontenot
2009-11-18 10:41 ` [PATCH 0/4] Merge OF dynamic patches Wolfram Sang
2009-11-18 10:41   ` Wolfram Sang
2009-11-18 20:16   ` Nathan Fontenot
2009-11-18 20:16     ` Nathan Fontenot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B046B10.3040101@austin.ibm.com \
    --to=nfont-v7bbcbafuwjmbyb6qlfgeg@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.