Skip to contentSkip to conversation

Merge OF dynamic patches

PATCH Superseded Nathan Fontenot 4 participants 13 messages Nov 17, 2009 – Nov 19, 2009 8 messages not in the archive

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Merge OF dynamic patches

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

#2 lore raw

PATCH 1/4 Merge of_attach_node

In reply to a message not in the archive

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

---

arch/microblaze/kernel/prom.c +0 -0
Index: test-devicetree/arch/microblaze/kernel/prom.c
===================================================================
@@ -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.

arch/powerpc/kernel/prom.c +0 -0
Index: test-devicetree/arch/powerpc/kernel/prom.c
===================================================================
@@ -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.

drivers/of/of_dynamic.c new file +36 -0
Index: test-devicetree/drivers/of/of_dynamic.c
===================================================================
@@ -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);
+}
+
#5 lore raw

PATCH 2/4 Merge of_detach_node

In reply to Nathan Fontenot

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

---

arch/microblaze/kernel/prom.c +0 -0
Index: test-devicetree/arch/microblaze/kernel/prom.c
===================================================================
@@ -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)

arch/powerpc/kernel/prom.c +0 -0
Index: test-devicetree/arch/powerpc/kernel/prom.c
===================================================================
@@ -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:

drivers/of/of_dynamic.c +0 -0
Index: test-devicetree/drivers/of/of_dynamic.c
===================================================================
@@ -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);
+}

#8 lore raw

PATCH 3/4 Makefile and Kconfig updates for of_dynamci

In reply to Nathan Fontenot

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.

---

arch/microblaze/Kconfig +0 -0
Index: test-devicetree/arch/microblaze/Kconfig
===================================================================
@@ -111,6 +111,7 @@
 

config OF
def_bool y
+ select OF_DYNAMIC

config PROC_DEVICETREE
bool "Support for device tree in /proc"

arch/powerpc/Kconfig +0 -0
Index: test-devicetree/arch/powerpc/Kconfig
===================================================================
@@ -163,6 +163,7 @@
 

config OF
def_bool y
+ select OF_DYNAMIC

config PPC_UDBG_16550
bool

drivers/of/Kconfig +4 -0
Index: test-devicetree/drivers/of/Kconfig
===================================================================
@@ -1,3 +1,7 @@
+config OF_DYNAMIC
+	bool
+	depends on OF
+

config OF_DEVICE

	def_bool y
	depends on OF && (SPARC || PPC_OF || MICROBLAZE)
drivers/of/Makefile +0 -0
Index: test-devicetree/drivers/of/Makefile
===================================================================
@@ -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

#11 lore raw

PATCH 4/4 Move of_node[attach,detach] declarations to linux/of.h

In reply to Nathan Fontenot

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.

---

arch/microblaze/include/asm/prom.h +0 -0
Index: test-devicetree/arch/microblaze/include/asm/prom.h
===================================================================
@@ -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);

arch/powerpc/include/asm/prom.h +0 -0
Index: test-devicetree/arch/powerpc/include/asm/prom.h
===================================================================
@@ -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);

arch/powerpc/platforms/pseries/reconfig.c +0 -0
Index: test-devicetree/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
@@ -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>

include/linux/of.h +0 -0
Index: test-devicetree/include/linux/of.h
===================================================================
@@ -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 */

#18 lore raw
In reply to Nathan Fontenot
Quoted 6 lines · Nathan Fontenot

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

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

#20 lore raw
In reply to a message not in the archive
Quoted 10 lines · Wolfram Sang
Quoted 6 lines · Nathan Fontenot

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.

Quoted 3 lines

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

#4 lore raw

Re: [PATCH 1/4] Merge of_attach_node

In reply to a message not in the archive

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

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

---

arch/microblaze/kernel/prom.c |   15 ---------------
arch/powerpc/kernel/prom.c    |   15 ---------------
drivers/of/of_dynamic.c       |   36 ++++++++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+), 30 deletions(-)
arch/microblaze/kernel/prom.c +0 -0
Index: test-devicetree/arch/microblaze/kernel/prom.c
===================================================================
@@ -483,21 +483,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.

arch/powerpc/kernel/prom.c +0 -0
Index: test-devicetree/arch/powerpc/kernel/prom.c
===================================================================
@@ -936,21 +936,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.

drivers/of/of_dynamic.c new file +36 -0
Index: test-devicetree/drivers/of/of_dynamic.c
===================================================================
@@ -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);
+}
+
#7 lore raw

Re: [PATCH 2/4] Merge of_detach_node

In reply to a message not in the archive

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.

---

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(-)
arch/microblaze/kernel/prom.c +0 -0
Index: test-devicetree/arch/microblaze/kernel/prom.c
===================================================================
@@ -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;

arch/powerpc/kernel/prom.c +0 -0
Index: test-devicetree/arch/powerpc/kernel/prom.c
===================================================================
@@ -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:

drivers/of/of_dynamic.c +0 -0
Index: test-devicetree/drivers/of/of_dynamic.c
===================================================================
@@ -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);
+}

#10 lore raw

Re: [PATCH 3/4] Makefile and Kconfig updates for of_dynamci

In reply to a message not in the archive

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.

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

---

arch/microblaze/Kconfig |    1 +
arch/powerpc/Kconfig    |    1 +
drivers/of/Kconfig      |    4 ++++
drivers/of/Makefile     |    1 +
4 files changed, 7 insertions(+)
arch/microblaze/Kconfig +0 -0
Index: test-devicetree/arch/microblaze/Kconfig
===================================================================
@@ -112,6 +112,7 @@

config OF
def_bool y
select OF_FLATTREE
+ select OF_DYNAMIC

config PROC_DEVICETREE
bool "Support for device tree in /proc"

arch/powerpc/Kconfig +0 -0
Index: test-devicetree/arch/powerpc/Kconfig
===================================================================
@@ -164,6 +164,7 @@

config OF
def_bool y
select OF_FLATTREE
+ select OF_DYNAMIC

config PPC_UDBG_16550
bool

drivers/of/Kconfig +0 -0
Index: test-devicetree/drivers/of/Kconfig
===================================================================
@@ -2,6 +2,10 @@

bool
depends on OF

+config OF_DYNAMIC
+ bool
+ depends on OF
+
config OF_DEVICE

	def_bool y
	depends on OF && (SPARC || PPC_OF || MICROBLAZE)
drivers/of/Makefile +0 -0
Index: test-devicetree/drivers/of/Makefile
===================================================================
@@ -1,5 +1,6 @@

obj-y = base.o
obj-$(CONFIG_OF_FLATTREE) += fdt.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

#13 lore raw

Re: [PATCH 4/4] Move of_node[attach, detach] declarations to linux/of.h

In reply to a message not in the archive

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.

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

---

arch/microblaze/include/asm/prom.h        |    4 ----
arch/powerpc/include/asm/prom.h           |    4 ----
arch/powerpc/platforms/pseries/reconfig.c |    1 +
include/linux/of.h                        |    6 ++++++
4 files changed, 7 insertions(+), 8 deletions(-)
arch/microblaze/include/asm/prom.h +0 -0
Index: test-devicetree/arch/microblaze/include/asm/prom.h
===================================================================
@@ -39,10 +39,6 @@
 

extern rwlock_t devtree_lock; /* temporary while merging */

-/* 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 int early_uartlite_console(void);

arch/powerpc/include/asm/prom.h +0 -0
Index: test-devicetree/arch/powerpc/include/asm/prom.h
===================================================================
@@ -34,10 +34,6 @@
 

#define HAVE_ARCH_DEVTREE_FIXUPS

-/* For updating the device tree at runtime */ -extern void of_attach_node(struct device_node *); -extern void of_detach_node(struct device_node *); -
#ifdef CONFIG_PPC32
/*
* PCI <-> OF matching functions

arch/powerpc/platforms/pseries/reconfig.c +0 -0
Index: test-devicetree/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
@@ -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>

include/linux/of.h +0 -0
Index: test-devicetree/include/linux/of.h
===================================================================
@@ -187,4 +187,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 */

#15 lore raw

Re: [PATCH 4/4] Move of_node[attach, detach] declarations to linux/of.h

In reply to a message not in the archive
Quoted 25 lines · On Wed, 18 Nov 2009 15:48:02 -0600 Nathan Fontenot…

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.

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

Signed-off-by: Nathan Fontenot <[email protected]> ---

 arch/microblaze/include/asm/prom.h        |    4 ----
 arch/powerpc/include/asm/prom.h           |    4 ----
 arch/powerpc/platforms/pseries/reconfig.c |    1 +
 include/linux/of.h                        |    6 ++++++
 4 files changed, 7 insertions(+), 8 deletions(-)

Index: test-devicetree/arch/microblaze/include/asm/prom.h
===================================================================
--- test-devicetree.orig/arch/microblaze/include/asm/prom.h

2009-11-18 17:34:36.000000000 -0600 +++

test-devicetree/arch/microblaze/include/asm/prom.h 2009-11-18
19:26:53.000000000 -0600 @@ -39,10 +39,6 @@
extern rwlock_t devtree_lock; /* temporary while merging */

Review

Quoted 4 lines
(quoted diff) +0 -4
-/* For updating the device tree at runtime */
-extern void of_attach_node(struct device_node *);
-extern void of_detach_node(struct device_node *);
-

Minor points, but I'd recommend moving the declarations at the same time as the definitions. That is, move the of_attach_node declaration in patch1 and of_detach_node declaration in patch2.

Quoted 38 lines

/* 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-18 17:34:36.000000000 -0600 +++

test-devicetree/arch/powerpc/include/asm/prom.h 2009-11-18
19:27:32.000000000 -0600 @@ -34,10 +34,6 @@
#define HAVE_ARCH_DEVTREE_FIXUPS

(quoted diff) +0 -4
-/* For updating the device tree at runtime */
-extern void of_attach_node(struct device_node *);
-extern void of_detach_node(struct device_node *);
-
 #ifdef CONFIG_PPC32
 /*
  * PCI <-> OF matching functions

Index: test-devicetree/arch/powerpc/platforms/pseries/reconfig.c
===================================================================
---
test-devicetree.orig/arch/powerpc/platforms/pseries/reconfig.c

2009-11-18 17:23:40.000000000 -0600 +++
test-devicetree/arch/powerpc/platforms/pseries/reconfig.c
2009-11-18 19:26:53.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-18
17:34:36.000000000 -0600 +++
test-devicetree/include/linux/of.h 2009-11-18
19:26:53.000000000 -0600 @@ -187,4 +187,10 @@ const char *list_name, const char *cells_name, int index, struct device_node **out_node, const void **out_args);

Review

Quoted 7 lines
(quoted diff) +6 -0
+#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 */

The trend seems to be a different header file per config option. "of_dynamic.h" would be the logic extension of that..

#17 lore raw

Re: [PATCH 4/4] Move of_node[attach, detach] declarations to linux/of.h

In reply to a message not in the archive
Quoted 9 lines · Andres Salomon

Review

Quoted 4 lines
(quoted diff) +0 -4
-/* For updating the device tree at runtime */
-extern void of_attach_node(struct device_node *);
-extern void of_detach_node(struct device_node *);
-

Minor points, but I'd recommend moving the declarations at the same time as the definitions. That is, move the of_attach_node declaration in patch1 and of_detach_node declaration in patch2.

No problem, I'll update the patches to do this.
---

Quoted 9 lines
Quoted 9 lines

===================================================================
--- test-devicetree.orig/include/linux/of.h 2009-11-18
17:34:36.000000000 -0600 +++
test-devicetree/include/linux/of.h 2009-11-18
19:26:53.000000000 -0600 @@ -187,4 +187,10 @@ const char *list_name, const char *cells_name, int index, struct device_node **out_node, const void **out_args);

(quoted diff) +2 -0
+#ifdef CONFIG_OF_DYNAMIC
+/* For updating the device tree at runtime */
Quoted 9 lines

Review

Quoted 5 lines
(quoted diff) +4 -0
+extern void of_attach_node(struct device_node *);
+extern void of_detach_node(struct device_node *);
+#endif
+
 #endif /* _LINUX_OF_H */

The trend seems to be a different header file per config option. "of_dynamic.h" would be the logic extension of that..

Works for me, updated patches coming soon.

-Nathan Fontenot