linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Merge OF dynamic patches
@ 2009-11-17 21:04 Nathan Fontenot
  2009-11-18  2:53 ` [PATCH 1/4] Merge of_attach_node Nathan Fontenot
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Nathan Fontenot @ 2009-11-17 21:04 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, microblaze-uclinux

This set of patches merges the common dynamic device tree
updating routines of_attach_node() and of_detach_node() to
drivers/of/of_dynamic.c.

Built and tested on powerpc, I have no access to build/test
this on microblaze.

-Nathan Fontenot

1/4 - Merge of_attach_node
2/4 - Merge of_detach_node
3/4 - Makefile/Kconfig updates
4/4 - Move declarations to linux/of.h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] Merge of_attach_node
  2009-11-17 21:04 [PATCH 0/4] Merge OF dynamic patches Nathan Fontenot
@ 2009-11-18  2:53 ` Nathan Fontenot
  2009-11-18  2:55 ` [PATCH 2/4] Merge of_detach_node Nathan Fontenot
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Nathan Fontenot @ 2009-11-18  2:53 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, microblaze-uclinux

Merge the common of_attach_node() routine from powerpc and microblaze to
drivers/of/of_dynamic.c

Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---

Index: test-devicetree/arch/microblaze/kernel/prom.c
===================================================================
--- test-devicetree.orig/arch/microblaze/kernel/prom.c	2009-11-17 13:52:45.000000000 -0600
+++ test-devicetree/arch/microblaze/kernel/prom.c	2009-11-17 14:17:05.000000000 -0600
@@ -957,21 +957,6 @@
 EXPORT_SYMBOL(of_node_put);
 
 /*
- * Plug a device node into the tree and global list.
- */
-void of_attach_node(struct device_node *np)
-{
-	unsigned long flags;
-
-	write_lock_irqsave(&devtree_lock, flags);
-	np->sibling = np->parent->child;
-	np->allnext = allnodes;
-	np->parent->child = np;
-	allnodes = np;
-	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.
Index: test-devicetree/arch/powerpc/kernel/prom.c
===================================================================
--- test-devicetree.orig/arch/powerpc/kernel/prom.c	2009-11-17 13:52:45.000000000 -0600
+++ test-devicetree/arch/powerpc/kernel/prom.c	2009-11-17 14:17:05.000000000 -0600
@@ -1413,21 +1413,6 @@
 EXPORT_SYMBOL(of_node_put);
 
 /*
- * Plug a device node into the tree and global list.
- */
-void of_attach_node(struct device_node *np)
-{
-	unsigned long flags;
-
-	write_lock_irqsave(&devtree_lock, flags);
-	np->sibling = np->parent->child;
-	np->allnext = allnodes;
-	np->parent->child = np;
-	allnodes = np;
-	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.
Index: test-devicetree/drivers/of/of_dynamic.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ test-devicetree/drivers/of/of_dynamic.c	2009-11-17 14:18:11.000000000 -0600
@@ -0,0 +1,36 @@
+/*
+ * Procedures for creating, accessing and interpreting the device tree.
+ *
+ * Paul Mackerras	August 1996.
+ * Copyright (C) 1996-2005 Paul Mackerras.
+ *
+ *  Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
+ *    {engebret|bergner}@us.ibm.com
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of the GNU General Public License
+ *      as published by the Free Software Foundation; either version
+ *      2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/of.h>
+
+/* temporary while merging */
+extern struct device_node *allnodes;
+extern rwlock_t devtree_lock;
+
+/*
+ * Plug a device node into the tree and global list.
+ */
+void of_attach_node(struct device_node *np)
+{
+	unsigned long flags;
+
+	write_lock_irqsave(&devtree_lock, flags);
+	np->sibling = np->parent->child;
+	np->allnext = allnodes;
+	np->parent->child = np;
+	allnodes = np;
+	write_unlock_irqrestore(&devtree_lock, flags);
+}
+

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/4] Merge of_detach_node
  2009-11-17 21:04 [PATCH 0/4] Merge OF dynamic patches Nathan Fontenot
  2009-11-18  2:53 ` [PATCH 1/4] Merge of_attach_node Nathan Fontenot
@ 2009-11-18  2:55 ` Nathan Fontenot
  2009-11-18  2:56 ` [PATCH 3/4] Makefile and Kconfig updates for of_dynamci Nathan Fontenot
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Nathan Fontenot @ 2009-11-18  2:55 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, microblaze-uclinux

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>
---

Index: test-devicetree/arch/microblaze/kernel/prom.c
===================================================================
--- test-devicetree.orig/arch/microblaze/kernel/prom.c	2009-11-17 14:17:05.000000000 -0600
+++ test-devicetree/arch/microblaze/kernel/prom.c	2009-11-17 14:18:18.000000000 -0600
@@ -957,50 +957,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);
-}
-
-/*
  * Add a property to a node
  */
 int prom_add_property(struct device_node *np, struct property *prop)
Index: test-devicetree/arch/powerpc/kernel/prom.c
===================================================================
--- test-devicetree.orig/arch/powerpc/kernel/prom.c	2009-11-17 14:17:05.000000000 -0600
+++ test-devicetree/arch/powerpc/kernel/prom.c	2009-11-17 14:18:18.000000000 -0600
@@ -1412,50 +1412,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-17 14:18:11.000000000 -0600
+++ test-devicetree/drivers/of/of_dynamic.c	2009-11-17 14:18:18.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);
+}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/4] Makefile and Kconfig updates for of_dynamci
  2009-11-17 21:04 [PATCH 0/4] Merge OF dynamic patches Nathan Fontenot
  2009-11-18  2:53 ` [PATCH 1/4] Merge of_attach_node Nathan Fontenot
  2009-11-18  2:55 ` [PATCH 2/4] Merge of_detach_node Nathan Fontenot
@ 2009-11-18  2:56 ` Nathan Fontenot
  2009-11-18  2:57 ` [PATCH 4/4] Move of_node[attach,detach] declarations to linux/of.h Nathan Fontenot
  2009-11-18 10:41 ` [PATCH 0/4] Merge OF dynamic patches Wolfram Sang
  4 siblings, 0 replies; 7+ messages in thread
From: Nathan Fontenot @ 2009-11-18  2:56 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, microblaze-uclinux

Update the Kconfig and Makefile files for drivers/of, powerpc and microblaze
to properly configure for CONFIG_OF_DYNAMIC to build the of_dynamic code.

Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---

Index: test-devicetree/arch/microblaze/Kconfig
===================================================================
--- test-devicetree.orig/arch/microblaze/Kconfig	2009-11-17 13:52:45.000000000 -0600
+++ test-devicetree/arch/microblaze/Kconfig	2009-11-17 14:01:06.000000000 -0600
@@ -111,6 +111,7 @@
 
 config OF
 	def_bool y
+	select OF_DYNAMIC
 
 config PROC_DEVICETREE
 	bool "Support for device tree in /proc"
Index: test-devicetree/arch/powerpc/Kconfig
===================================================================
--- test-devicetree.orig/arch/powerpc/Kconfig	2009-11-17 13:52:45.000000000 -0600
+++ test-devicetree/arch/powerpc/Kconfig	2009-11-17 14:01:06.000000000 -0600
@@ -163,6 +163,7 @@
 
 config OF
 	def_bool y
+	select OF_DYNAMIC
 
 config PPC_UDBG_16550
 	bool
Index: test-devicetree/drivers/of/Kconfig
===================================================================
--- test-devicetree.orig/drivers/of/Kconfig	2009-11-17 13:52:48.000000000 -0600
+++ test-devicetree/drivers/of/Kconfig	2009-11-17 14:01:06.000000000 -0600
@@ -1,3 +1,7 @@
+config OF_DYNAMIC
+	bool
+	depends on OF
+
 config OF_DEVICE
 	def_bool y
 	depends on OF && (SPARC || PPC_OF || MICROBLAZE)
Index: test-devicetree/drivers/of/Makefile
===================================================================
--- test-devicetree.orig/drivers/of/Makefile	2009-11-17 13:52:48.000000000 -0600
+++ test-devicetree/drivers/of/Makefile	2009-11-17 14:01:06.000000000 -0600
@@ -1,4 +1,5 @@
 obj-y = base.o
+obj-$(CONFIG_OF_DYNAMIC) += of_dynamic.o
 obj-$(CONFIG_OF_DEVICE) += device.o platform.o
 obj-$(CONFIG_OF_GPIO)   += gpio.o
 obj-$(CONFIG_OF_I2C)	+= of_i2c.o

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/4] Move of_node[attach,detach] declarations to linux/of.h
  2009-11-17 21:04 [PATCH 0/4] Merge OF dynamic patches Nathan Fontenot
                   ` (2 preceding siblings ...)
  2009-11-18  2:56 ` [PATCH 3/4] Makefile and Kconfig updates for of_dynamci Nathan Fontenot
@ 2009-11-18  2:57 ` Nathan Fontenot
  2009-11-18 10:41 ` [PATCH 0/4] Merge OF dynamic patches Wolfram Sang
  4 siblings, 0 replies; 7+ messages in thread
From: Nathan Fontenot @ 2009-11-18  2:57 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, microblaze-uclinux

Merge the declarations of of_attach_node and of_detach_node from the asm/prom.h
headers of powerpc and microblaze into linux/of.h.

This update also requires adding linux/of.h to the include list for
powerpc/platforms/pseries/reconfig.h.

Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
---

Index: test-devicetree/arch/microblaze/include/asm/prom.h
===================================================================
--- test-devicetree.orig/arch/microblaze/include/asm/prom.h	2009-11-17 14:17:03.000000000 -0600
+++ test-devicetree/arch/microblaze/include/asm/prom.h	2009-11-17 14:18:25.000000000 -0600
@@ -139,10 +139,6 @@
 		of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long __init of_get_flat_dt_root(void);
 
-/* For updating the device tree at runtime */
-extern void of_attach_node(struct device_node *);
-extern void of_detach_node(struct device_node *);
-
 /* Other Prototypes */
 extern void finish_device_tree(void);
 extern void unflatten_device_tree(void);
Index: test-devicetree/arch/powerpc/include/asm/prom.h
===================================================================
--- test-devicetree.orig/arch/powerpc/include/asm/prom.h	2009-11-17 14:17:03.000000000 -0600
+++ test-devicetree/arch/powerpc/include/asm/prom.h	2009-11-17 14:18:25.000000000 -0600
@@ -137,10 +137,6 @@
 extern int __init of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long __init of_get_flat_dt_root(void);
 
-/* For updating the device tree at runtime */
-extern void of_attach_node(struct device_node *);
-extern void of_detach_node(struct device_node *);
-
 /* Other Prototypes */
 extern void finish_device_tree(void);
 extern void unflatten_device_tree(void);
Index: test-devicetree/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
--- test-devicetree.orig/arch/powerpc/platforms/pseries/reconfig.c	2009-11-17 14:17:03.000000000 -0600
+++ test-devicetree/arch/powerpc/platforms/pseries/reconfig.c	2009-11-17 14:18:25.000000000 -0600
@@ -15,6 +15,7 @@
 #include <linux/kref.h>
 #include <linux/notifier.h>
 #include <linux/proc_fs.h>
+#include <linux/of.h>
 
 #include <asm/prom.h>
 #include <asm/machdep.h>
Index: test-devicetree/include/linux/of.h
===================================================================
--- test-devicetree.orig/include/linux/of.h	2009-11-17 14:17:03.000000000 -0600
+++ test-devicetree/include/linux/of.h	2009-11-17 14:18:25.000000000 -0600
@@ -84,4 +84,10 @@
 	const char *list_name, const char *cells_name, int index,
 	struct device_node **out_node, const void **out_args);
 
+#ifdef CONFIG_OF_DYNAMIC
+/* For updating the device tree at runtime */
+extern void of_attach_node(struct device_node *);
+extern void of_detach_node(struct device_node *);
+#endif
+
 #endif /* _LINUX_OF_H */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] Merge OF dynamic patches
  2009-11-17 21:04 [PATCH 0/4] Merge OF dynamic patches Nathan Fontenot
                   ` (3 preceding siblings ...)
  2009-11-18  2:57 ` [PATCH 4/4] Move of_node[attach,detach] declarations to linux/of.h Nathan Fontenot
@ 2009-11-18 10:41 ` Wolfram Sang
  2009-11-18 20:16   ` Nathan Fontenot
  4 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2009-11-18 10:41 UTC (permalink / raw)
  To: Nathan Fontenot; +Cc: linuxppc-dev, devicetree-discuss, microblaze-uclinux

[-- Attachment #1: Type: text/plain, Size: 732 bytes --]

On Tue, Nov 17, 2009 at 03:04:02PM -0600, Nathan Fontenot wrote:
> This set of patches merges the common dynamic device tree
> updating routines of_attach_node() and of_detach_node() to
> drivers/of/of_dynamic.c.
>
> Built and tested on powerpc, I have no access to build/test
> this on microblaze.

They look good, but I can't test them as they don't apply to test-devicetree.
On which commit are they based?

It would be nice if you could also add a diffstat to every patch, this makes
reviewing 'move-around'-patches a bit easier.

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] Merge OF dynamic patches
  2009-11-18 10:41 ` [PATCH 0/4] Merge OF dynamic patches Wolfram Sang
@ 2009-11-18 20:16   ` Nathan Fontenot
  0 siblings, 0 replies; 7+ messages in thread
From: Nathan Fontenot @ 2009-11-18 20:16 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linuxppc-dev, devicetree-discuss, microblaze-uclinux

Wolfram Sang wrote:
> On Tue, Nov 17, 2009 at 03:04:02PM -0600, Nathan Fontenot wrote:
>> This set of patches merges the common dynamic device tree
>> updating routines of_attach_node() and of_detach_node() to
>> drivers/of/of_dynamic.c.
>>
>> Built and tested on powerpc, I have no access to build/test
>> this on microblaze.
> 
> They look good, but I can't test them as they don't apply to test-devicetree.
> On which commit are they based?

I meant to base these on the test-devicetree branch but it appears that I did
not checkout the test-devicetree branch after cloning.  I will rebase the patches
against the test-devicetree branch and re-send.

> 
> It would be nice if you could also add a diffstat to every patch, this makes
> reviewing 'move-around'-patches a bit easier.

will do.

-Nathan Fontenot

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-11-18 20:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-17 21:04 [PATCH 0/4] Merge OF dynamic patches Nathan Fontenot
2009-11-18  2:53 ` [PATCH 1/4] Merge of_attach_node Nathan Fontenot
2009-11-18  2:55 ` [PATCH 2/4] Merge of_detach_node Nathan Fontenot
2009-11-18  2:56 ` [PATCH 3/4] Makefile and Kconfig updates for of_dynamci Nathan Fontenot
2009-11-18  2:57 ` [PATCH 4/4] Move of_node[attach,detach] declarations to linux/of.h Nathan Fontenot
2009-11-18 10:41 ` [PATCH 0/4] Merge OF dynamic patches Wolfram Sang
2009-11-18 20:16   ` Nathan Fontenot

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).