From: Nathan Fontenot <nfont@austin.ibm.com>
To: devicetree-discuss@lists.ozlabs.org,
linuxppc-dev@lists.ozlabs.org, microblaze-uclinux@itee.uq.edu.au
Subject: [PATCH 2/4 v2] Merge of_detach_node
Date: Fri, 20 Nov 2009 09:06:57 -0600 [thread overview]
Message-ID: <4B06B091.3030506@austin.ibm.com> (raw)
In-Reply-To: <4B06AF33.1000400@austin.ibm.com>
Merge the common of_detach_node() from powerpc and microblaze into the common
drivers/of/of_dynamic.c
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---
arch/microblaze/include/asm/prom.h | 3 --
arch/microblaze/kernel/prom.c | 44 -------------------------------------
arch/powerpc/include/asm/prom.h | 3 --
arch/powerpc/kernel/prom.c | 44 -------------------------------------
drivers/of/of_dynamic.c | 43 ++++++++++++++++++++++++++++++++++++
include/linux/of_dynamic.h | 1
6 files changed, 44 insertions(+), 94 deletions(-)
Index: test-devicetree/arch/microblaze/kernel/prom.c
===================================================================
--- test-devicetree.orig/arch/microblaze/kernel/prom.c 2009-11-20 11:59:03.000000000 -0600
+++ test-devicetree/arch/microblaze/kernel/prom.c 2009-11-20 12:28:33.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-20 11:59:03.000000000 -0600
+++ test-devicetree/arch/powerpc/kernel/prom.c 2009-11-20 12:28:33.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-20 12:27:24.000000000 -0600
+++ test-devicetree/drivers/of/of_dynamic.c 2009-11-20 12:28:33.000000000 -0600
@@ -30,3 +30,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);
+}
Index: test-devicetree/arch/microblaze/include/asm/prom.h
===================================================================
--- test-devicetree.orig/arch/microblaze/include/asm/prom.h 2009-11-20 12:24:47.000000000 -0600
+++ test-devicetree/arch/microblaze/include/asm/prom.h 2009-11-20 12:30:33.000000000 -0600
@@ -39,9 +39,6 @@
extern rwlock_t devtree_lock; /* temporary while merging */
-/* For updating the device tree at runtime */
-extern void of_detach_node(struct device_node *);
-
/* Other Prototypes */
extern int early_uartlite_console(void);
Index: test-devicetree/arch/powerpc/include/asm/prom.h
===================================================================
--- test-devicetree.orig/arch/powerpc/include/asm/prom.h 2009-11-20 12:24:07.000000000 -0600
+++ test-devicetree/arch/powerpc/include/asm/prom.h 2009-11-20 12:30:41.000000000 -0600
@@ -34,9 +34,6 @@
#define HAVE_ARCH_DEVTREE_FIXUPS
-/* For updating the device tree at runtime */
-extern void of_detach_node(struct device_node *);
-
#ifdef CONFIG_PPC32
/*
* PCI <-> OF matching functions
Index: test-devicetree/include/linux/of_dynamic.h
===================================================================
--- test-devicetree.orig/include/linux/of_dynamic.h 2009-11-20 12:27:09.000000000 -0600
+++ test-devicetree/include/linux/of_dynamic.h 2009-11-20 12:30:22.000000000 -0600
@@ -23,4 +23,5 @@
extern rwlock_t devtree_lock;
extern void of_attach_node(struct device_node *);
+extern void of_detach_node(struct device_node *);
#endif
next prev parent reply other threads:[~2009-11-20 15:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-20 15:01 [PATCH 0/4 v2] Merge OF dynamic patches Nathan Fontenot
2009-11-20 15:05 ` [PATCH 1/4 v2] Merge of_attach_node Nathan Fontenot
2009-11-20 15:06 ` Nathan Fontenot [this message]
2009-11-20 15:08 ` [PATCH 3/4 v2] Makefile and Kconfig updates Nathan Fontenot
2009-11-20 15:09 ` [PATCH 4/4 v2] Include of_dynamic.h in pseries/reconfig.c Nathan Fontenot
2009-11-20 21:40 ` [PATCH 0/4 v2] Merge OF dynamic patches Grant Likely
2009-11-23 13:27 ` [microblaze-uclinux] " Michal Simek
2009-11-23 15:38 ` 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=4B06B091.3030506@austin.ibm.com \
--to=nfont@austin.ibm.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=microblaze-uclinux@itee.uq.edu.au \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).