All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] Yet another series of OF merge patches.
@ 2009-11-24  8:17 ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:17 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Nothing much to say here other than mostly mechanical merging of OF
support code.  Some of it remains a little ugly, but I'm taking the
approach of merging the code first, and refactoring it second.

I've pushed this series out to my test-devicetree branch on my git
server if anyone wants to test.  That branch also includes the
previous 2 patch series that I've sent out.

git://git.secretlab.ca/git/linux-2.6 test-devicetree

Compile tested on: ppc64, ppc32, microblaze, sparc64, sparc32.
Boot tested on mpc5200 (ppc32) platform.

---

Grant Likely (11):
      of: unify phandle name in struct device_node
      microblaze: gut implementation of early_init_dt_scan_cpus()
      of: merge of_attach_node() & of_detach_node()
      of: Merge of_node_get() and of_node_put()
      of: merge machine_is_compatible()
      of/flattree: merge early_init_devtree() and early_init_move_devtree()
      of/flattree: merge early_init_dt_scan_chosen()
      of/flattree: eliminate cell_t typedef
      of/flattree: merge dt_mem_next_cell
      of/flattree: Merge earlyinit_dt_scan_root()
      of/flattree: Merge early_init_dt_check_for_initrd()


 arch/microblaze/include/asm/prom.h           |    4 
 arch/microblaze/kernel/prom.c                |  375 +-------------------------
 arch/powerpc/include/asm/prom.h              |    4 
 arch/powerpc/kernel/prom.c                   |  366 ++-----------------------
 arch/powerpc/platforms/powermac/pfunc_core.c |    2 
 arch/sparc/kernel/devices.c                  |    2 
 arch/sparc/kernel/of_device_32.c             |    2 
 arch/sparc/kernel/of_device_64.c             |    2 
 arch/sparc/kernel/prom_common.c              |    8 -
 arch/sparc/kernel/smp_64.c                   |    2 
 drivers/of/base.c                            |  153 +++++++++++
 drivers/of/fdt.c                             |  204 ++++++++++++++
 drivers/sbus/char/openprom.c                 |   10 -
 drivers/video/aty/atyfb_base.c               |    2 
 include/linux/of.h                           |    7 
 include/linux/of_fdt.h                       |   18 +
 16 files changed, 430 insertions(+), 731 deletions(-)

-- 
Signature

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

* [PATCH 00/11] Yet another series of OF merge patches.
@ 2009-11-24  8:17 ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:17 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Nothing much to say here other than mostly mechanical merging of OF
support code.  Some of it remains a little ugly, but I'm taking the
approach of merging the code first, and refactoring it second.

I've pushed this series out to my test-devicetree branch on my git
server if anyone wants to test.  That branch also includes the
previous 2 patch series that I've sent out.

git://git.secretlab.ca/git/linux-2.6 test-devicetree

Compile tested on: ppc64, ppc32, microblaze, sparc64, sparc32.
Boot tested on mpc5200 (ppc32) platform.

---

Grant Likely (11):
      of: unify phandle name in struct device_node
      microblaze: gut implementation of early_init_dt_scan_cpus()
      of: merge of_attach_node() & of_detach_node()
      of: Merge of_node_get() and of_node_put()
      of: merge machine_is_compatible()
      of/flattree: merge early_init_devtree() and early_init_move_devtree()
      of/flattree: merge early_init_dt_scan_chosen()
      of/flattree: eliminate cell_t typedef
      of/flattree: merge dt_mem_next_cell
      of/flattree: Merge earlyinit_dt_scan_root()
      of/flattree: Merge early_init_dt_check_for_initrd()


 arch/microblaze/include/asm/prom.h           |    4 
 arch/microblaze/kernel/prom.c                |  375 +-------------------------
 arch/powerpc/include/asm/prom.h              |    4 
 arch/powerpc/kernel/prom.c                   |  366 ++-----------------------
 arch/powerpc/platforms/powermac/pfunc_core.c |    2 
 arch/sparc/kernel/devices.c                  |    2 
 arch/sparc/kernel/of_device_32.c             |    2 
 arch/sparc/kernel/of_device_64.c             |    2 
 arch/sparc/kernel/prom_common.c              |    8 -
 arch/sparc/kernel/smp_64.c                   |    2 
 drivers/of/base.c                            |  153 +++++++++++
 drivers/of/fdt.c                             |  204 ++++++++++++++
 drivers/sbus/char/openprom.c                 |   10 -
 drivers/video/aty/atyfb_base.c               |    2 
 include/linux/of.h                           |    7 
 include/linux/of_fdt.h                       |   18 +
 16 files changed, 430 insertions(+), 731 deletions(-)

-- 
Signature

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

* [PATCH 00/11] Yet another series of OF merge patches.
@ 2009-11-24  8:17 ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:17 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

Nothing much to say here other than mostly mechanical merging of OF
support code.  Some of it remains a little ugly, but I'm taking the
approach of merging the code first, and refactoring it second.

I've pushed this series out to my test-devicetree branch on my git
server if anyone wants to test.  That branch also includes the
previous 2 patch series that I've sent out.

git://git.secretlab.ca/git/linux-2.6 test-devicetree

Compile tested on: ppc64, ppc32, microblaze, sparc64, sparc32.
Boot tested on mpc5200 (ppc32) platform.

---

Grant Likely (11):
      of: unify phandle name in struct device_node
      microblaze: gut implementation of early_init_dt_scan_cpus()
      of: merge of_attach_node() & of_detach_node()
      of: Merge of_node_get() and of_node_put()
      of: merge machine_is_compatible()
      of/flattree: merge early_init_devtree() and early_init_move_devtree()
      of/flattree: merge early_init_dt_scan_chosen()
      of/flattree: eliminate cell_t typedef
      of/flattree: merge dt_mem_next_cell
      of/flattree: Merge earlyinit_dt_scan_root()
      of/flattree: Merge early_init_dt_check_for_initrd()


 arch/microblaze/include/asm/prom.h           |    4 
 arch/microblaze/kernel/prom.c                |  375 +-------------------------
 arch/powerpc/include/asm/prom.h              |    4 
 arch/powerpc/kernel/prom.c                   |  366 ++-----------------------
 arch/powerpc/platforms/powermac/pfunc_core.c |    2 
 arch/sparc/kernel/devices.c                  |    2 
 arch/sparc/kernel/of_device_32.c             |    2 
 arch/sparc/kernel/of_device_64.c             |    2 
 arch/sparc/kernel/prom_common.c              |    8 -
 arch/sparc/kernel/smp_64.c                   |    2 
 drivers/of/base.c                            |  153 +++++++++++
 drivers/of/fdt.c                             |  204 ++++++++++++++
 drivers/sbus/char/openprom.c                 |   10 -
 drivers/video/aty/atyfb_base.c               |    2 
 include/linux/of.h                           |    7 
 include/linux/of_fdt.h                       |   18 +
 16 files changed, 430 insertions(+), 731 deletions(-)

-- 
Signature

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

* [PATCH 01/11] of/flattree: Merge early_init_dt_check_for_initrd()
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-24  8:17   ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:17 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
---

 arch/microblaze/kernel/prom.c |   32 --------------------------------
 arch/powerpc/kernel/prom.c    |   30 ------------------------------
 drivers/of/fdt.c              |   37 +++++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    1 +
 4 files changed, 38 insertions(+), 62 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index a38e373..7959495 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -113,38 +113,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-static void __init early_init_dt_check_for_initrd(unsigned long node)
-{
-	unsigned long l;
-	u32 *prop;
-
-	pr_debug("Looking for initrd properties... ");
-
-	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
-	if (prop) {
-		initrd_start = (unsigned long)
-					__va((u32)of_read_ulong(prop, l/4));
-
-		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
-		if (prop) {
-			initrd_end = (unsigned long)
-					__va((u32)of_read_ulong(prop, 1/4));
-			initrd_below_start_ok = 1;
-		} else {
-			initrd_start = 0;
-		}
-	}
-
-	pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
-					initrd_start, initrd_end);
-}
-#else
-static inline void early_init_dt_check_for_initrd(unsigned long node)
-{
-}
-#endif /* CONFIG_BLK_DEV_INITRD */
-
 static int __init early_init_dt_scan_chosen(unsigned long node,
 				const char *uname, int depth, void *data)
 {
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 7f88566..1ecd6c6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -373,36 +373,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-static void __init early_init_dt_check_for_initrd(unsigned long node)
-{
-	unsigned long l;
-	u32 *prop;
-
-	DBG("Looking for initrd properties... ");
-
-	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
-	if (prop) {
-		initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
-
-		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
-		if (prop) {
-			initrd_end = (unsigned long)
-					__va(of_read_ulong(prop, l/4));
-			initrd_below_start_ok = 1;
-		} else {
-			initrd_start = 0;
-		}
-	}
-
-	DBG("initrd_start=0x%lx  initrd_end=0x%lx\n", initrd_start, initrd_end);
-}
-#else
-static inline void early_init_dt_check_for_initrd(unsigned long node)
-{
-}
-#endif /* CONFIG_BLK_DEV_INITRD */
-
 static int __init early_init_dt_scan_chosen(unsigned long node,
 					    const char *uname, int depth, void *data)
 {
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 43d236c..6ad98e8 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -11,6 +11,7 @@
 
 #include <linux/kernel.h>
 #include <linux/lmb.h>
+#include <linux/initrd.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 
@@ -369,6 +370,42 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
 	return mem;
 }
 
+#ifdef CONFIG_BLK_DEV_INITRD
+/**
+ * early_init_dt_check_for_initrd - Decode initrd location from flat tree
+ * @node: reference to node containing initrd location ('chosen')
+ */
+void __init early_init_dt_check_for_initrd(unsigned long node)
+{
+	unsigned long len;
+	u32 *prop;
+
+	pr_debug("Looking for initrd properties... ");
+
+	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len);
+	if (prop) {
+		initrd_start = (unsigned long)
+				__va(of_read_ulong(prop, len/4));
+
+		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len);
+		if (prop) {
+			initrd_end = (unsigned long)
+				__va(of_read_ulong(prop, len/4));
+			initrd_below_start_ok = 1;
+		} else {
+			initrd_start = 0;
+		}
+	}
+
+	pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
+		 initrd_start, initrd_end);
+}
+#else
+inline void early_init_dt_check_for_initrd(unsigned long node)
+{
+}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
 /**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 81231e0..ec2db82 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -69,6 +69,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
 				 unsigned long *size);
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
+extern void early_init_dt_check_for_initrd(unsigned long node);
 
 /* Other Prototypes */
 extern void finish_device_tree(void);


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

* [PATCH 01/11] of/flattree: Merge early_init_dt_check_for_initrd()
@ 2009-11-24  8:17   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:17 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
---

 arch/microblaze/kernel/prom.c |   32 --------------------------------
 arch/powerpc/kernel/prom.c    |   30 ------------------------------
 drivers/of/fdt.c              |   37 +++++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    1 +
 4 files changed, 38 insertions(+), 62 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index a38e373..7959495 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -113,38 +113,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-static void __init early_init_dt_check_for_initrd(unsigned long node)
-{
-	unsigned long l;
-	u32 *prop;
-
-	pr_debug("Looking for initrd properties... ");
-
-	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
-	if (prop) {
-		initrd_start = (unsigned long)
-					__va((u32)of_read_ulong(prop, l/4));
-
-		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
-		if (prop) {
-			initrd_end = (unsigned long)
-					__va((u32)of_read_ulong(prop, 1/4));
-			initrd_below_start_ok = 1;
-		} else {
-			initrd_start = 0;
-		}
-	}
-
-	pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
-					initrd_start, initrd_end);
-}
-#else
-static inline void early_init_dt_check_for_initrd(unsigned long node)
-{
-}
-#endif /* CONFIG_BLK_DEV_INITRD */
-
 static int __init early_init_dt_scan_chosen(unsigned long node,
 				const char *uname, int depth, void *data)
 {
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 7f88566..1ecd6c6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -373,36 +373,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-static void __init early_init_dt_check_for_initrd(unsigned long node)
-{
-	unsigned long l;
-	u32 *prop;
-
-	DBG("Looking for initrd properties... ");
-
-	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
-	if (prop) {
-		initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
-
-		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
-		if (prop) {
-			initrd_end = (unsigned long)
-					__va(of_read_ulong(prop, l/4));
-			initrd_below_start_ok = 1;
-		} else {
-			initrd_start = 0;
-		}
-	}
-
-	DBG("initrd_start=0x%lx  initrd_end=0x%lx\n", initrd_start, initrd_end);
-}
-#else
-static inline void early_init_dt_check_for_initrd(unsigned long node)
-{
-}
-#endif /* CONFIG_BLK_DEV_INITRD */
-
 static int __init early_init_dt_scan_chosen(unsigned long node,
 					    const char *uname, int depth, void *data)
 {
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 43d236c..6ad98e8 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -11,6 +11,7 @@
 
 #include <linux/kernel.h>
 #include <linux/lmb.h>
+#include <linux/initrd.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 
@@ -369,6 +370,42 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
 	return mem;
 }
 
+#ifdef CONFIG_BLK_DEV_INITRD
+/**
+ * early_init_dt_check_for_initrd - Decode initrd location from flat tree
+ * @node: reference to node containing initrd location ('chosen')
+ */
+void __init early_init_dt_check_for_initrd(unsigned long node)
+{
+	unsigned long len;
+	u32 *prop;
+
+	pr_debug("Looking for initrd properties... ");
+
+	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len);
+	if (prop) {
+		initrd_start = (unsigned long)
+				__va(of_read_ulong(prop, len/4));
+
+		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len);
+		if (prop) {
+			initrd_end = (unsigned long)
+				__va(of_read_ulong(prop, len/4));
+			initrd_below_start_ok = 1;
+		} else {
+			initrd_start = 0;
+		}
+	}
+
+	pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
+		 initrd_start, initrd_end);
+}
+#else
+inline void early_init_dt_check_for_initrd(unsigned long node)
+{
+}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
 /**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 81231e0..ec2db82 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -69,6 +69,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
 				 unsigned long *size);
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
+extern void early_init_dt_check_for_initrd(unsigned long node);
 
 /* Other Prototypes */
 extern void finish_device_tree(void);


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

* [PATCH 01/11] of/flattree: Merge early_init_dt_check_for_initrd()
@ 2009-11-24  8:17   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:17 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
---

 arch/microblaze/kernel/prom.c |   32 --------------------------------
 arch/powerpc/kernel/prom.c    |   30 ------------------------------
 drivers/of/fdt.c              |   37 +++++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    1 +
 4 files changed, 38 insertions(+), 62 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index a38e373..7959495 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -113,38 +113,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-static void __init early_init_dt_check_for_initrd(unsigned long node)
-{
-	unsigned long l;
-	u32 *prop;
-
-	pr_debug("Looking for initrd properties... ");
-
-	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
-	if (prop) {
-		initrd_start = (unsigned long)
-					__va((u32)of_read_ulong(prop, l/4));
-
-		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
-		if (prop) {
-			initrd_end = (unsigned long)
-					__va((u32)of_read_ulong(prop, 1/4));
-			initrd_below_start_ok = 1;
-		} else {
-			initrd_start = 0;
-		}
-	}
-
-	pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
-					initrd_start, initrd_end);
-}
-#else
-static inline void early_init_dt_check_for_initrd(unsigned long node)
-{
-}
-#endif /* CONFIG_BLK_DEV_INITRD */
-
 static int __init early_init_dt_scan_chosen(unsigned long node,
 				const char *uname, int depth, void *data)
 {
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 7f88566..1ecd6c6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -373,36 +373,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-static void __init early_init_dt_check_for_initrd(unsigned long node)
-{
-	unsigned long l;
-	u32 *prop;
-
-	DBG("Looking for initrd properties... ");
-
-	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
-	if (prop) {
-		initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
-
-		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
-		if (prop) {
-			initrd_end = (unsigned long)
-					__va(of_read_ulong(prop, l/4));
-			initrd_below_start_ok = 1;
-		} else {
-			initrd_start = 0;
-		}
-	}
-
-	DBG("initrd_start=0x%lx  initrd_end=0x%lx\n", initrd_start, initrd_end);
-}
-#else
-static inline void early_init_dt_check_for_initrd(unsigned long node)
-{
-}
-#endif /* CONFIG_BLK_DEV_INITRD */
-
 static int __init early_init_dt_scan_chosen(unsigned long node,
 					    const char *uname, int depth, void *data)
 {
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 43d236c..6ad98e8 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -11,6 +11,7 @@
 
 #include <linux/kernel.h>
 #include <linux/lmb.h>
+#include <linux/initrd.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 
@@ -369,6 +370,42 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
 	return mem;
 }
 
+#ifdef CONFIG_BLK_DEV_INITRD
+/**
+ * early_init_dt_check_for_initrd - Decode initrd location from flat tree
+ * @node: reference to node containing initrd location ('chosen')
+ */
+void __init early_init_dt_check_for_initrd(unsigned long node)
+{
+	unsigned long len;
+	u32 *prop;
+
+	pr_debug("Looking for initrd properties... ");
+
+	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len);
+	if (prop) {
+		initrd_start = (unsigned long)
+				__va(of_read_ulong(prop, len/4));
+
+		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len);
+		if (prop) {
+			initrd_end = (unsigned long)
+				__va(of_read_ulong(prop, len/4));
+			initrd_below_start_ok = 1;
+		} else {
+			initrd_start = 0;
+		}
+	}
+
+	pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
+		 initrd_start, initrd_end);
+}
+#else
+inline void early_init_dt_check_for_initrd(unsigned long node)
+{
+}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
 /**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 81231e0..ec2db82 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -69,6 +69,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
 				 unsigned long *size);
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
+extern void early_init_dt_check_for_initrd(unsigned long node);
 
 /* Other Prototypes */
 extern void finish_device_tree(void);

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

* [PATCH 02/11] of/flattree: Merge earlyinit_dt_scan_root()
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-24  8:18   ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   23 -----------------------
 arch/powerpc/kernel/prom.c    |   24 ------------------------
 drivers/of/fdt.c              |   26 ++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    6 ++++++
 4 files changed, 32 insertions(+), 47 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 7959495..189179a 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -42,9 +42,6 @@
 #include <asm/sections.h>
 #include <asm/pci-bridge.h>
 
-static int __initdata dt_root_addr_cells;
-static int __initdata dt_root_size_cells;
-
 typedef u32 cell_t;
 
 /* export that to outside world */
@@ -158,26 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static int __init early_init_dt_scan_root(unsigned long node,
-				const char *uname, int depth, void *data)
-{
-	u32 *prop;
-
-	if (depth != 0)
-		return 0;
-
-	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
-	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
-	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
-
-	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
-	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
-	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
-
-	/* break now */
-	return 1;
-}
-
 static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
 {
 	cell_t *p = *cellp;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 1ecd6c6..78f65a4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -61,10 +61,6 @@
 #define DBG(fmt...)
 #endif
 
-
-static int __initdata dt_root_addr_cells;
-static int __initdata dt_root_size_cells;
-
 #ifdef CONFIG_PPC64
 int __initdata iommu_is_off;
 int __initdata iommu_force_on;
@@ -436,26 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static int __init early_init_dt_scan_root(unsigned long node,
-					  const char *uname, int depth, void *data)
-{
-	u32 *prop;
-
-	if (depth != 0)
-		return 0;
-
-	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
-	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
-	DBG("dt_root_size_cells = %x\n", dt_root_size_cells);
-
-	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
-	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
-	DBG("dt_root_addr_cells = %x\n", dt_root_addr_cells);
-	
-	/* break now */
-	return 1;
-}
-
 static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
 {
 	cell_t *p = *cellp;
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 6ad98e8..be200be 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -15,6 +15,9 @@
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 
+int __initdata dt_root_addr_cells;
+int __initdata dt_root_size_cells;
+
 struct boot_param_header *initial_boot_params;
 
 char *find_flat_dt_string(u32 offset)
@@ -407,6 +410,29 @@ inline void early_init_dt_check_for_initrd(unsigned long node)
 #endif /* CONFIG_BLK_DEV_INITRD */
 
 /**
+ * early_init_dt_scan_root - fetch the top level address and size cells
+ */
+int __init early_init_dt_scan_root(unsigned long node, const char *uname,
+				   int depth, void *data)
+{
+	u32 *prop;
+
+	if (depth != 0)
+		return 0;
+
+	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
+	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
+	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
+
+	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
+	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
+	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
+
+	/* break now */
+	return 1;
+}
+
+/**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
  * unflattens the device-tree passed by the firmware, creating the
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ec2db82..828c3cd 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -58,6 +58,8 @@ struct boot_param_header {
 };
 
 /* TBD: Temporary export of fdt globals - remove when code fully merged */
+extern int __initdata dt_root_addr_cells;
+extern int __initdata dt_root_size_cells;
 extern struct boot_param_header *initial_boot_params;
 
 /* For scanning the flat device-tree at boot time */
@@ -71,6 +73,10 @@ extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
 extern void early_init_dt_check_for_initrd(unsigned long node);
 
+/* Early flat tree scan hooks */
+extern int early_init_dt_scan_root(unsigned long node, const char *uname,
+				   int depth, void *data);
+
 /* Other Prototypes */
 extern void finish_device_tree(void);
 extern void unflatten_device_tree(void);


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

* [PATCH 02/11] of/flattree: Merge earlyinit_dt_scan_root()
@ 2009-11-24  8:18   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   23 -----------------------
 arch/powerpc/kernel/prom.c    |   24 ------------------------
 drivers/of/fdt.c              |   26 ++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    6 ++++++
 4 files changed, 32 insertions(+), 47 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 7959495..189179a 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -42,9 +42,6 @@
 #include <asm/sections.h>
 #include <asm/pci-bridge.h>
 
-static int __initdata dt_root_addr_cells;
-static int __initdata dt_root_size_cells;
-
 typedef u32 cell_t;
 
 /* export that to outside world */
@@ -158,26 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static int __init early_init_dt_scan_root(unsigned long node,
-				const char *uname, int depth, void *data)
-{
-	u32 *prop;
-
-	if (depth != 0)
-		return 0;
-
-	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
-	dt_root_size_cells = (prop = NULL) ? 1 : *prop;
-	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
-
-	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
-	dt_root_addr_cells = (prop = NULL) ? 2 : *prop;
-	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
-
-	/* break now */
-	return 1;
-}
-
 static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
 {
 	cell_t *p = *cellp;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 1ecd6c6..78f65a4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -61,10 +61,6 @@
 #define DBG(fmt...)
 #endif
 
-
-static int __initdata dt_root_addr_cells;
-static int __initdata dt_root_size_cells;
-
 #ifdef CONFIG_PPC64
 int __initdata iommu_is_off;
 int __initdata iommu_force_on;
@@ -436,26 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static int __init early_init_dt_scan_root(unsigned long node,
-					  const char *uname, int depth, void *data)
-{
-	u32 *prop;
-
-	if (depth != 0)
-		return 0;
-
-	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
-	dt_root_size_cells = (prop = NULL) ? 1 : *prop;
-	DBG("dt_root_size_cells = %x\n", dt_root_size_cells);
-
-	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
-	dt_root_addr_cells = (prop = NULL) ? 2 : *prop;
-	DBG("dt_root_addr_cells = %x\n", dt_root_addr_cells);
-	
-	/* break now */
-	return 1;
-}
-
 static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
 {
 	cell_t *p = *cellp;
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 6ad98e8..be200be 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -15,6 +15,9 @@
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 
+int __initdata dt_root_addr_cells;
+int __initdata dt_root_size_cells;
+
 struct boot_param_header *initial_boot_params;
 
 char *find_flat_dt_string(u32 offset)
@@ -407,6 +410,29 @@ inline void early_init_dt_check_for_initrd(unsigned long node)
 #endif /* CONFIG_BLK_DEV_INITRD */
 
 /**
+ * early_init_dt_scan_root - fetch the top level address and size cells
+ */
+int __init early_init_dt_scan_root(unsigned long node, const char *uname,
+				   int depth, void *data)
+{
+	u32 *prop;
+
+	if (depth != 0)
+		return 0;
+
+	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
+	dt_root_size_cells = (prop = NULL) ? 1 : *prop;
+	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
+
+	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
+	dt_root_addr_cells = (prop = NULL) ? 2 : *prop;
+	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
+
+	/* break now */
+	return 1;
+}
+
+/**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
  * unflattens the device-tree passed by the firmware, creating the
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ec2db82..828c3cd 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -58,6 +58,8 @@ struct boot_param_header {
 };
 
 /* TBD: Temporary export of fdt globals - remove when code fully merged */
+extern int __initdata dt_root_addr_cells;
+extern int __initdata dt_root_size_cells;
 extern struct boot_param_header *initial_boot_params;
 
 /* For scanning the flat device-tree at boot time */
@@ -71,6 +73,10 @@ extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
 extern void early_init_dt_check_for_initrd(unsigned long node);
 
+/* Early flat tree scan hooks */
+extern int early_init_dt_scan_root(unsigned long node, const char *uname,
+				   int depth, void *data);
+
 /* Other Prototypes */
 extern void finish_device_tree(void);
 extern void unflatten_device_tree(void);


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

* [PATCH 02/11] of/flattree: Merge earlyinit_dt_scan_root()
@ 2009-11-24  8:18   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   23 -----------------------
 arch/powerpc/kernel/prom.c    |   24 ------------------------
 drivers/of/fdt.c              |   26 ++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    6 ++++++
 4 files changed, 32 insertions(+), 47 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 7959495..189179a 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -42,9 +42,6 @@
 #include <asm/sections.h>
 #include <asm/pci-bridge.h>
 
-static int __initdata dt_root_addr_cells;
-static int __initdata dt_root_size_cells;
-
 typedef u32 cell_t;
 
 /* export that to outside world */
@@ -158,26 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static int __init early_init_dt_scan_root(unsigned long node,
-				const char *uname, int depth, void *data)
-{
-	u32 *prop;
-
-	if (depth != 0)
-		return 0;
-
-	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
-	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
-	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
-
-	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
-	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
-	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
-
-	/* break now */
-	return 1;
-}
-
 static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
 {
 	cell_t *p = *cellp;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 1ecd6c6..78f65a4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -61,10 +61,6 @@
 #define DBG(fmt...)
 #endif
 
-
-static int __initdata dt_root_addr_cells;
-static int __initdata dt_root_size_cells;
-
 #ifdef CONFIG_PPC64
 int __initdata iommu_is_off;
 int __initdata iommu_force_on;
@@ -436,26 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static int __init early_init_dt_scan_root(unsigned long node,
-					  const char *uname, int depth, void *data)
-{
-	u32 *prop;
-
-	if (depth != 0)
-		return 0;
-
-	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
-	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
-	DBG("dt_root_size_cells = %x\n", dt_root_size_cells);
-
-	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
-	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
-	DBG("dt_root_addr_cells = %x\n", dt_root_addr_cells);
-	
-	/* break now */
-	return 1;
-}
-
 static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
 {
 	cell_t *p = *cellp;
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 6ad98e8..be200be 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -15,6 +15,9 @@
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 
+int __initdata dt_root_addr_cells;
+int __initdata dt_root_size_cells;
+
 struct boot_param_header *initial_boot_params;
 
 char *find_flat_dt_string(u32 offset)
@@ -407,6 +410,29 @@ inline void early_init_dt_check_for_initrd(unsigned long node)
 #endif /* CONFIG_BLK_DEV_INITRD */
 
 /**
+ * early_init_dt_scan_root - fetch the top level address and size cells
+ */
+int __init early_init_dt_scan_root(unsigned long node, const char *uname,
+				   int depth, void *data)
+{
+	u32 *prop;
+
+	if (depth != 0)
+		return 0;
+
+	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
+	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
+	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
+
+	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
+	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
+	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
+
+	/* break now */
+	return 1;
+}
+
+/**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
  * unflattens the device-tree passed by the firmware, creating the
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ec2db82..828c3cd 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -58,6 +58,8 @@ struct boot_param_header {
 };
 
 /* TBD: Temporary export of fdt globals - remove when code fully merged */
+extern int __initdata dt_root_addr_cells;
+extern int __initdata dt_root_size_cells;
 extern struct boot_param_header *initial_boot_params;
 
 /* For scanning the flat device-tree at boot time */
@@ -71,6 +73,10 @@ extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
 extern void early_init_dt_check_for_initrd(unsigned long node);
 
+/* Early flat tree scan hooks */
+extern int early_init_dt_scan_root(unsigned long node, const char *uname,
+				   int depth, void *data);
+
 /* Other Prototypes */
 extern void finish_device_tree(void);
 extern void unflatten_device_tree(void);

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

* [PATCH 03/11] of/flattree: merge dt_mem_next_cell
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-24  8:18   ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |    8 --------
 arch/powerpc/kernel/prom.c    |    8 --------
 drivers/of/fdt.c              |    8 ++++++++
 include/linux/of_fdt.h        |    1 +
 4 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 189179a..e0f4c34 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -155,14 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
-{
-	cell_t *p = *cellp;
-
-	*cellp = p + s;
-	return of_read_number(p, s);
-}
-
 static int __init early_init_dt_scan_memory(unsigned long node,
 				const char *uname, int depth, void *data)
 {
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 78f65a4..048e3a3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -432,14 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
-{
-	cell_t *p = *cellp;
-
-	*cellp = p + s;
-	return of_read_number(p, s);
-}
-
 #ifdef CONFIG_PPC_PSERIES
 /*
  * Interpret the ibm,dynamic-memory property in the
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index be200be..ebce509 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -432,6 +432,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
 	return 1;
 }
 
+u64 __init dt_mem_next_cell(int s, u32 **cellp)
+{
+	u32 *p = *cellp;
+
+	*cellp = p + s;
+	return of_read_number(p, s);
+}
+
 /**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 828c3cd..d1a37e5 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -72,6 +72,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
 extern void early_init_dt_check_for_initrd(unsigned long node);
+extern u64 dt_mem_next_cell(int s, u32 **cellp);
 
 /* Early flat tree scan hooks */
 extern int early_init_dt_scan_root(unsigned long node, const char *uname,


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

* [PATCH 03/11] of/flattree: merge dt_mem_next_cell
@ 2009-11-24  8:18   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |    8 --------
 arch/powerpc/kernel/prom.c    |    8 --------
 drivers/of/fdt.c              |    8 ++++++++
 include/linux/of_fdt.h        |    1 +
 4 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 189179a..e0f4c34 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -155,14 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
-{
-	cell_t *p = *cellp;
-
-	*cellp = p + s;
-	return of_read_number(p, s);
-}
-
 static int __init early_init_dt_scan_memory(unsigned long node,
 				const char *uname, int depth, void *data)
 {
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 78f65a4..048e3a3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -432,14 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
-{
-	cell_t *p = *cellp;
-
-	*cellp = p + s;
-	return of_read_number(p, s);
-}
-
 #ifdef CONFIG_PPC_PSERIES
 /*
  * Interpret the ibm,dynamic-memory property in the
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index be200be..ebce509 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -432,6 +432,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
 	return 1;
 }
 
+u64 __init dt_mem_next_cell(int s, u32 **cellp)
+{
+	u32 *p = *cellp;
+
+	*cellp = p + s;
+	return of_read_number(p, s);
+}
+
 /**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 828c3cd..d1a37e5 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -72,6 +72,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
 extern void early_init_dt_check_for_initrd(unsigned long node);
+extern u64 dt_mem_next_cell(int s, u32 **cellp);
 
 /* Early flat tree scan hooks */
 extern int early_init_dt_scan_root(unsigned long node, const char *uname,


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

* [PATCH 03/11] of/flattree: merge dt_mem_next_cell
@ 2009-11-24  8:18   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |    8 --------
 arch/powerpc/kernel/prom.c    |    8 --------
 drivers/of/fdt.c              |    8 ++++++++
 include/linux/of_fdt.h        |    1 +
 4 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 189179a..e0f4c34 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -155,14 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
-{
-	cell_t *p = *cellp;
-
-	*cellp = p + s;
-	return of_read_number(p, s);
-}
-
 static int __init early_init_dt_scan_memory(unsigned long node,
 				const char *uname, int depth, void *data)
 {
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 78f65a4..048e3a3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -432,14 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	return 1;
 }
 
-static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
-{
-	cell_t *p = *cellp;
-
-	*cellp = p + s;
-	return of_read_number(p, s);
-}
-
 #ifdef CONFIG_PPC_PSERIES
 /*
  * Interpret the ibm,dynamic-memory property in the
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index be200be..ebce509 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -432,6 +432,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
 	return 1;
 }
 
+u64 __init dt_mem_next_cell(int s, u32 **cellp)
+{
+	u32 *p = *cellp;
+
+	*cellp = p + s;
+	return of_read_number(p, s);
+}
+
 /**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 828c3cd..d1a37e5 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -72,6 +72,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
 extern void early_init_dt_check_for_initrd(unsigned long node);
+extern u64 dt_mem_next_cell(int s, u32 **cellp);
 
 /* Early flat tree scan hooks */
 extern int early_init_dt_scan_root(unsigned long node, const char *uname,

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

* [PATCH 04/11] of/flattree: eliminate cell_t typedef
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-24  8:18   ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

A cell is firmly established as a u32.  No need to do an ugly typedef
to redefine it to cell_t.  Eliminate the unnecessary typedef so that
it doesn't have to be added to the of_fdt header file

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   10 ++++------
 arch/powerpc/kernel/prom.c    |   14 ++++++--------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index e0f4c34..7760186 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -42,8 +42,6 @@
 #include <asm/sections.h>
 #include <asm/pci-bridge.h>
 
-typedef u32 cell_t;
-
 /* export that to outside world */
 struct device_node *of_chosen;
 
@@ -159,7 +157,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 				const char *uname, int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	cell_t *reg, *endp;
+	u32 *reg, *endp;
 	unsigned long l;
 
 	/* Look for the ibm,dynamic-reconfiguration-memory node */
@@ -178,13 +176,13 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 	} else if (strcmp(type, "memory") != 0)
 		return 0;
 
-	reg = (cell_t *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
+	reg = (u32 *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
 	if (reg == NULL)
-		reg = (cell_t *)of_get_flat_dt_prop(node, "reg", &l);
+		reg = (u32 *)of_get_flat_dt_prop(node, "reg", &l);
 	if (reg == NULL)
 		return 0;
 
-	endp = reg + (l / sizeof(cell_t));
+	endp = reg + (l / sizeof(u32));
 
 	pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
 		uname, l, reg[0], reg[1], reg[2], reg[3]);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 048e3a3..43cdba2 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -67,8 +67,6 @@ int __initdata iommu_force_on;
 unsigned long tce_alloc_start, tce_alloc_end;
 #endif
 
-typedef u32 cell_t;
-
 extern rwlock_t devtree_lock;	/* temporary while merging */
 
 /* export that to outside world */
@@ -441,22 +439,22 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
  */
 static int __init early_init_dt_scan_drconf_memory(unsigned long node)
 {
-	cell_t *dm, *ls, *usm;
+	u32 *dm, *ls, *usm;
 	unsigned long l, n, flags;
 	u64 base, size, lmb_size;
 	unsigned int is_kexec_kdump = 0, rngs;
 
 	ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
-	if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t))
+	if (ls == NULL || l < dt_root_size_cells * sizeof(u32))
 		return 0;
 	lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls);
 
 	dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l);
-	if (dm == NULL || l < sizeof(cell_t))
+	if (dm == NULL || l < sizeof(u32))
 		return 0;
 
 	n = *dm++;	/* number of entries */
-	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t))
+	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(u32))
 		return 0;
 
 	/* check if this is a kexec/kdump kernel. */
@@ -515,7 +513,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 					    const char *uname, int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	cell_t *reg, *endp;
+	u32 *reg, *endp;
 	unsigned long l;
 
 	/* Look for the ibm,dynamic-reconfiguration-memory node */
@@ -540,7 +538,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 	if (reg == NULL)
 		return 0;
 
-	endp = reg + (l / sizeof(cell_t));
+	endp = reg + (l / sizeof(u32));
 
 	DBG("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
 	    uname, l, reg[0], reg[1], reg[2], reg[3]);


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

* [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-24  8:18   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

A cell is firmly established as a u32.  No need to do an ugly typedef
to redefine it to cell_t.  Eliminate the unnecessary typedef so that
it doesn't have to be added to the of_fdt header file

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   10 ++++------
 arch/powerpc/kernel/prom.c    |   14 ++++++--------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index e0f4c34..7760186 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -42,8 +42,6 @@
 #include <asm/sections.h>
 #include <asm/pci-bridge.h>
 
-typedef u32 cell_t;
-
 /* export that to outside world */
 struct device_node *of_chosen;
 
@@ -159,7 +157,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 				const char *uname, int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	cell_t *reg, *endp;
+	u32 *reg, *endp;
 	unsigned long l;
 
 	/* Look for the ibm,dynamic-reconfiguration-memory node */
@@ -178,13 +176,13 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 	} else if (strcmp(type, "memory") != 0)
 		return 0;
 
-	reg = (cell_t *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
+	reg = (u32 *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
 	if (reg = NULL)
-		reg = (cell_t *)of_get_flat_dt_prop(node, "reg", &l);
+		reg = (u32 *)of_get_flat_dt_prop(node, "reg", &l);
 	if (reg = NULL)
 		return 0;
 
-	endp = reg + (l / sizeof(cell_t));
+	endp = reg + (l / sizeof(u32));
 
 	pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
 		uname, l, reg[0], reg[1], reg[2], reg[3]);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 048e3a3..43cdba2 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -67,8 +67,6 @@ int __initdata iommu_force_on;
 unsigned long tce_alloc_start, tce_alloc_end;
 #endif
 
-typedef u32 cell_t;
-
 extern rwlock_t devtree_lock;	/* temporary while merging */
 
 /* export that to outside world */
@@ -441,22 +439,22 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
  */
 static int __init early_init_dt_scan_drconf_memory(unsigned long node)
 {
-	cell_t *dm, *ls, *usm;
+	u32 *dm, *ls, *usm;
 	unsigned long l, n, flags;
 	u64 base, size, lmb_size;
 	unsigned int is_kexec_kdump = 0, rngs;
 
 	ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
-	if (ls = NULL || l < dt_root_size_cells * sizeof(cell_t))
+	if (ls = NULL || l < dt_root_size_cells * sizeof(u32))
 		return 0;
 	lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls);
 
 	dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l);
-	if (dm = NULL || l < sizeof(cell_t))
+	if (dm = NULL || l < sizeof(u32))
 		return 0;
 
 	n = *dm++;	/* number of entries */
-	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t))
+	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(u32))
 		return 0;
 
 	/* check if this is a kexec/kdump kernel. */
@@ -515,7 +513,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 					    const char *uname, int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	cell_t *reg, *endp;
+	u32 *reg, *endp;
 	unsigned long l;
 
 	/* Look for the ibm,dynamic-reconfiguration-memory node */
@@ -540,7 +538,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 	if (reg = NULL)
 		return 0;
 
-	endp = reg + (l / sizeof(cell_t));
+	endp = reg + (l / sizeof(u32));
 
 	DBG("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
 	    uname, l, reg[0], reg[1], reg[2], reg[3]);


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

* [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-24  8:18   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

A cell is firmly established as a u32.  No need to do an ugly typedef
to redefine it to cell_t.  Eliminate the unnecessary typedef so that
it doesn't have to be added to the of_fdt header file

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   10 ++++------
 arch/powerpc/kernel/prom.c    |   14 ++++++--------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index e0f4c34..7760186 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -42,8 +42,6 @@
 #include <asm/sections.h>
 #include <asm/pci-bridge.h>
 
-typedef u32 cell_t;
-
 /* export that to outside world */
 struct device_node *of_chosen;
 
@@ -159,7 +157,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 				const char *uname, int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	cell_t *reg, *endp;
+	u32 *reg, *endp;
 	unsigned long l;
 
 	/* Look for the ibm,dynamic-reconfiguration-memory node */
@@ -178,13 +176,13 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 	} else if (strcmp(type, "memory") != 0)
 		return 0;
 
-	reg = (cell_t *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
+	reg = (u32 *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
 	if (reg == NULL)
-		reg = (cell_t *)of_get_flat_dt_prop(node, "reg", &l);
+		reg = (u32 *)of_get_flat_dt_prop(node, "reg", &l);
 	if (reg == NULL)
 		return 0;
 
-	endp = reg + (l / sizeof(cell_t));
+	endp = reg + (l / sizeof(u32));
 
 	pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
 		uname, l, reg[0], reg[1], reg[2], reg[3]);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 048e3a3..43cdba2 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -67,8 +67,6 @@ int __initdata iommu_force_on;
 unsigned long tce_alloc_start, tce_alloc_end;
 #endif
 
-typedef u32 cell_t;
-
 extern rwlock_t devtree_lock;	/* temporary while merging */
 
 /* export that to outside world */
@@ -441,22 +439,22 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
  */
 static int __init early_init_dt_scan_drconf_memory(unsigned long node)
 {
-	cell_t *dm, *ls, *usm;
+	u32 *dm, *ls, *usm;
 	unsigned long l, n, flags;
 	u64 base, size, lmb_size;
 	unsigned int is_kexec_kdump = 0, rngs;
 
 	ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
-	if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t))
+	if (ls == NULL || l < dt_root_size_cells * sizeof(u32))
 		return 0;
 	lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls);
 
 	dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l);
-	if (dm == NULL || l < sizeof(cell_t))
+	if (dm == NULL || l < sizeof(u32))
 		return 0;
 
 	n = *dm++;	/* number of entries */
-	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t))
+	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(u32))
 		return 0;
 
 	/* check if this is a kexec/kdump kernel. */
@@ -515,7 +513,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 					    const char *uname, int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	cell_t *reg, *endp;
+	u32 *reg, *endp;
 	unsigned long l;
 
 	/* Look for the ibm,dynamic-reconfiguration-memory node */
@@ -540,7 +538,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 	if (reg == NULL)
 		return 0;
 
-	endp = reg + (l / sizeof(cell_t));
+	endp = reg + (l / sizeof(u32));
 
 	DBG("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
 	    uname, l, reg[0], reg[1], reg[2], reg[3]);

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

* [PATCH 05/11] of/flattree: merge early_init_dt_scan_chosen()
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-24  8:18   ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze.  This patch
splits the arch-specific stuff out into a new function,
early_init_dt_scan_chosen_arch().

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   44 ++-------------------------------------
 arch/powerpc/kernel/prom.c    |   46 +++++++++--------------------------------
 drivers/of/fdt.c              |   38 ++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    3 +++
 4 files changed, 53 insertions(+), 78 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 7760186..7ee021f 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -108,49 +108,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-static int __init early_init_dt_scan_chosen(unsigned long node,
-				const char *uname, int depth, void *data)
+void __init early_init_dt_scan_chosen_arch(unsigned long node)
 {
-	unsigned long l;
-	char *p;
-
-	pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
-
-	if (depth != 1 ||
-		(strcmp(uname, "chosen") != 0 &&
-				strcmp(uname, "chosen@0") != 0))
-		return 0;
-
-#ifdef CONFIG_KEXEC
-	lprop = (u64 *)of_get_flat_dt_prop(node,
-				"linux,crashkernel-base", NULL);
-	if (lprop)
-		crashk_res.start = *lprop;
-
-	lprop = (u64 *)of_get_flat_dt_prop(node,
-				"linux,crashkernel-size", NULL);
-	if (lprop)
-		crashk_res.end = crashk_res.start + *lprop - 1;
-#endif
-
-	early_init_dt_check_for_initrd(node);
-
-	/* Retreive command line */
-	p = of_get_flat_dt_prop(node, "bootargs", &l);
-	if (p != NULL && l > 0)
-		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
-
-#ifdef CONFIG_CMDLINE
-#ifndef CONFIG_CMDLINE_FORCE
-	if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
-#endif
-		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif /* CONFIG_CMDLINE */
-
-	pr_debug("Command line is: %s\n", cmd_line);
-
-	/* break now */
-	return 1;
+	/* No Microblaze specific code here */
 }
 
 static int __init early_init_dt_scan_memory(unsigned long node,
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 43cdba2..2c7d4a3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -367,18 +367,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-static int __init early_init_dt_scan_chosen(unsigned long node,
-					    const char *uname, int depth, void *data)
+void __init early_init_dt_scan_chosen_arch(unsigned long node)
 {
 	unsigned long *lprop;
-	unsigned long l;
-	char *p;
-
-	DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
-
-	if (depth != 1 ||
-	    (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
-		return 0;
 
 #ifdef CONFIG_PPC64
 	/* check if iommu is forced on or off */
@@ -389,17 +380,17 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 #endif
 
 	/* mem=x on the command line is the preferred mechanism */
- 	lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL);
- 	if (lprop)
- 		memory_limit = *lprop;
+	lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL);
+	if (lprop)
+		memory_limit = *lprop;
 
 #ifdef CONFIG_PPC64
- 	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL);
- 	if (lprop)
- 		tce_alloc_start = *lprop;
- 	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL);
- 	if (lprop)
- 		tce_alloc_end = *lprop;
+	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL);
+	if (lprop)
+		tce_alloc_start = *lprop;
+	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL);
+	if (lprop)
+		tce_alloc_end = *lprop;
 #endif
 
 #ifdef CONFIG_KEXEC
@@ -411,23 +402,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	if (lprop)
 		crashk_res.end = crashk_res.start + *lprop - 1;
 #endif
-
-	early_init_dt_check_for_initrd(node);
-
-	/* Retreive command line */
- 	p = of_get_flat_dt_prop(node, "bootargs", &l);
-	if (p != NULL && l > 0)
-		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
-
-#ifdef CONFIG_CMDLINE
-	if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
-		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif /* CONFIG_CMDLINE */
-
-	DBG("Command line is: %s\n", cmd_line);
-
-	/* break now */
-	return 1;
 }
 
 #ifdef CONFIG_PPC_PSERIES
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ebce509..616a476 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -15,6 +15,10 @@
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 
+#ifdef CONFIG_PPC
+#include <asm/machdep.h>
+#endif /* CONFIG_PPC */
+
 int __initdata dt_root_addr_cells;
 int __initdata dt_root_size_cells;
 
@@ -440,6 +444,40 @@ u64 __init dt_mem_next_cell(int s, u32 **cellp)
 	return of_read_number(p, s);
 }
 
+int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
+				     int depth, void *data)
+{
+	unsigned long l;
+	char *p;
+
+	pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
+
+	if (depth != 1 ||
+	    (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
+		return 0;
+
+	early_init_dt_check_for_initrd(node);
+
+	/* Retreive command line */
+	p = of_get_flat_dt_prop(node, "bootargs", &l);
+	if (p != NULL && l > 0)
+		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
+
+#ifdef CONFIG_CMDLINE
+#ifndef CONFIG_CMDLINE_FORCE
+	if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
+#endif
+		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#endif /* CONFIG_CMDLINE */
+
+	early_init_dt_scan_chosen_arch(node);
+
+	pr_debug("Command line is: %s\n", cmd_line);
+
+	/* break now */
+	return 1;
+}
+
 /**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index d1a37e5..8118d45 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -71,6 +71,9 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
 				 unsigned long *size);
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
+extern void early_init_dt_scan_chosen_arch(unsigned long node);
+extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
+				     int depth, void *data);
 extern void early_init_dt_check_for_initrd(unsigned long node);
 extern u64 dt_mem_next_cell(int s, u32 **cellp);
 


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

* [PATCH 05/11] of/flattree: merge early_init_dt_scan_chosen()
@ 2009-11-24  8:18   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze.  This patch
splits the arch-specific stuff out into a new function,
early_init_dt_scan_chosen_arch().

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   44 ++-------------------------------------
 arch/powerpc/kernel/prom.c    |   46 +++++++++--------------------------------
 drivers/of/fdt.c              |   38 ++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    3 +++
 4 files changed, 53 insertions(+), 78 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 7760186..7ee021f 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -108,49 +108,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-static int __init early_init_dt_scan_chosen(unsigned long node,
-				const char *uname, int depth, void *data)
+void __init early_init_dt_scan_chosen_arch(unsigned long node)
 {
-	unsigned long l;
-	char *p;
-
-	pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
-
-	if (depth != 1 ||
-		(strcmp(uname, "chosen") != 0 &&
-				strcmp(uname, "chosen@0") != 0))
-		return 0;
-
-#ifdef CONFIG_KEXEC
-	lprop = (u64 *)of_get_flat_dt_prop(node,
-				"linux,crashkernel-base", NULL);
-	if (lprop)
-		crashk_res.start = *lprop;
-
-	lprop = (u64 *)of_get_flat_dt_prop(node,
-				"linux,crashkernel-size", NULL);
-	if (lprop)
-		crashk_res.end = crashk_res.start + *lprop - 1;
-#endif
-
-	early_init_dt_check_for_initrd(node);
-
-	/* Retreive command line */
-	p = of_get_flat_dt_prop(node, "bootargs", &l);
-	if (p != NULL && l > 0)
-		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
-
-#ifdef CONFIG_CMDLINE
-#ifndef CONFIG_CMDLINE_FORCE
-	if (p = NULL || l = 0 || (l = 1 && (*p) = 0))
-#endif
-		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif /* CONFIG_CMDLINE */
-
-	pr_debug("Command line is: %s\n", cmd_line);
-
-	/* break now */
-	return 1;
+	/* No Microblaze specific code here */
 }
 
 static int __init early_init_dt_scan_memory(unsigned long node,
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 43cdba2..2c7d4a3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -367,18 +367,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-static int __init early_init_dt_scan_chosen(unsigned long node,
-					    const char *uname, int depth, void *data)
+void __init early_init_dt_scan_chosen_arch(unsigned long node)
 {
 	unsigned long *lprop;
-	unsigned long l;
-	char *p;
-
-	DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
-
-	if (depth != 1 ||
-	    (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
-		return 0;
 
 #ifdef CONFIG_PPC64
 	/* check if iommu is forced on or off */
@@ -389,17 +380,17 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 #endif
 
 	/* mem=x on the command line is the preferred mechanism */
- 	lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL);
- 	if (lprop)
- 		memory_limit = *lprop;
+	lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL);
+	if (lprop)
+		memory_limit = *lprop;
 
 #ifdef CONFIG_PPC64
- 	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL);
- 	if (lprop)
- 		tce_alloc_start = *lprop;
- 	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL);
- 	if (lprop)
- 		tce_alloc_end = *lprop;
+	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL);
+	if (lprop)
+		tce_alloc_start = *lprop;
+	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL);
+	if (lprop)
+		tce_alloc_end = *lprop;
 #endif
 
 #ifdef CONFIG_KEXEC
@@ -411,23 +402,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	if (lprop)
 		crashk_res.end = crashk_res.start + *lprop - 1;
 #endif
-
-	early_init_dt_check_for_initrd(node);
-
-	/* Retreive command line */
- 	p = of_get_flat_dt_prop(node, "bootargs", &l);
-	if (p != NULL && l > 0)
-		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
-
-#ifdef CONFIG_CMDLINE
-	if (p = NULL || l = 0 || (l = 1 && (*p) = 0))
-		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif /* CONFIG_CMDLINE */
-
-	DBG("Command line is: %s\n", cmd_line);
-
-	/* break now */
-	return 1;
 }
 
 #ifdef CONFIG_PPC_PSERIES
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ebce509..616a476 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -15,6 +15,10 @@
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 
+#ifdef CONFIG_PPC
+#include <asm/machdep.h>
+#endif /* CONFIG_PPC */
+
 int __initdata dt_root_addr_cells;
 int __initdata dt_root_size_cells;
 
@@ -440,6 +444,40 @@ u64 __init dt_mem_next_cell(int s, u32 **cellp)
 	return of_read_number(p, s);
 }
 
+int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
+				     int depth, void *data)
+{
+	unsigned long l;
+	char *p;
+
+	pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
+
+	if (depth != 1 ||
+	    (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
+		return 0;
+
+	early_init_dt_check_for_initrd(node);
+
+	/* Retreive command line */
+	p = of_get_flat_dt_prop(node, "bootargs", &l);
+	if (p != NULL && l > 0)
+		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
+
+#ifdef CONFIG_CMDLINE
+#ifndef CONFIG_CMDLINE_FORCE
+	if (p = NULL || l = 0 || (l = 1 && (*p) = 0))
+#endif
+		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#endif /* CONFIG_CMDLINE */
+
+	early_init_dt_scan_chosen_arch(node);
+
+	pr_debug("Command line is: %s\n", cmd_line);
+
+	/* break now */
+	return 1;
+}
+
 /**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index d1a37e5..8118d45 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -71,6 +71,9 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
 				 unsigned long *size);
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
+extern void early_init_dt_scan_chosen_arch(unsigned long node);
+extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
+				     int depth, void *data);
 extern void early_init_dt_check_for_initrd(unsigned long node);
 extern u64 dt_mem_next_cell(int s, u32 **cellp);
 


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

* [PATCH 05/11] of/flattree: merge early_init_dt_scan_chosen()
@ 2009-11-24  8:18   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:18 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

Merge common code between PowerPC and Microblaze.  This patch
splits the arch-specific stuff out into a new function,
early_init_dt_scan_chosen_arch().

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   44 ++-------------------------------------
 arch/powerpc/kernel/prom.c    |   46 +++++++++--------------------------------
 drivers/of/fdt.c              |   38 ++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    3 +++
 4 files changed, 53 insertions(+), 78 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 7760186..7ee021f 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -108,49 +108,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-static int __init early_init_dt_scan_chosen(unsigned long node,
-				const char *uname, int depth, void *data)
+void __init early_init_dt_scan_chosen_arch(unsigned long node)
 {
-	unsigned long l;
-	char *p;
-
-	pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
-
-	if (depth != 1 ||
-		(strcmp(uname, "chosen") != 0 &&
-				strcmp(uname, "chosen@0") != 0))
-		return 0;
-
-#ifdef CONFIG_KEXEC
-	lprop = (u64 *)of_get_flat_dt_prop(node,
-				"linux,crashkernel-base", NULL);
-	if (lprop)
-		crashk_res.start = *lprop;
-
-	lprop = (u64 *)of_get_flat_dt_prop(node,
-				"linux,crashkernel-size", NULL);
-	if (lprop)
-		crashk_res.end = crashk_res.start + *lprop - 1;
-#endif
-
-	early_init_dt_check_for_initrd(node);
-
-	/* Retreive command line */
-	p = of_get_flat_dt_prop(node, "bootargs", &l);
-	if (p != NULL && l > 0)
-		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
-
-#ifdef CONFIG_CMDLINE
-#ifndef CONFIG_CMDLINE_FORCE
-	if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
-#endif
-		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif /* CONFIG_CMDLINE */
-
-	pr_debug("Command line is: %s\n", cmd_line);
-
-	/* break now */
-	return 1;
+	/* No Microblaze specific code here */
 }
 
 static int __init early_init_dt_scan_memory(unsigned long node,
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 43cdba2..2c7d4a3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -367,18 +367,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	return 0;
 }
 
-static int __init early_init_dt_scan_chosen(unsigned long node,
-					    const char *uname, int depth, void *data)
+void __init early_init_dt_scan_chosen_arch(unsigned long node)
 {
 	unsigned long *lprop;
-	unsigned long l;
-	char *p;
-
-	DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
-
-	if (depth != 1 ||
-	    (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
-		return 0;
 
 #ifdef CONFIG_PPC64
 	/* check if iommu is forced on or off */
@@ -389,17 +380,17 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 #endif
 
 	/* mem=x on the command line is the preferred mechanism */
- 	lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL);
- 	if (lprop)
- 		memory_limit = *lprop;
+	lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL);
+	if (lprop)
+		memory_limit = *lprop;
 
 #ifdef CONFIG_PPC64
- 	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL);
- 	if (lprop)
- 		tce_alloc_start = *lprop;
- 	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL);
- 	if (lprop)
- 		tce_alloc_end = *lprop;
+	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-start", NULL);
+	if (lprop)
+		tce_alloc_start = *lprop;
+	lprop = of_get_flat_dt_prop(node, "linux,tce-alloc-end", NULL);
+	if (lprop)
+		tce_alloc_end = *lprop;
 #endif
 
 #ifdef CONFIG_KEXEC
@@ -411,23 +402,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
 	if (lprop)
 		crashk_res.end = crashk_res.start + *lprop - 1;
 #endif
-
-	early_init_dt_check_for_initrd(node);
-
-	/* Retreive command line */
- 	p = of_get_flat_dt_prop(node, "bootargs", &l);
-	if (p != NULL && l > 0)
-		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
-
-#ifdef CONFIG_CMDLINE
-	if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
-		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif /* CONFIG_CMDLINE */
-
-	DBG("Command line is: %s\n", cmd_line);
-
-	/* break now */
-	return 1;
 }
 
 #ifdef CONFIG_PPC_PSERIES
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ebce509..616a476 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -15,6 +15,10 @@
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 
+#ifdef CONFIG_PPC
+#include <asm/machdep.h>
+#endif /* CONFIG_PPC */
+
 int __initdata dt_root_addr_cells;
 int __initdata dt_root_size_cells;
 
@@ -440,6 +444,40 @@ u64 __init dt_mem_next_cell(int s, u32 **cellp)
 	return of_read_number(p, s);
 }
 
+int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
+				     int depth, void *data)
+{
+	unsigned long l;
+	char *p;
+
+	pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
+
+	if (depth != 1 ||
+	    (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
+		return 0;
+
+	early_init_dt_check_for_initrd(node);
+
+	/* Retreive command line */
+	p = of_get_flat_dt_prop(node, "bootargs", &l);
+	if (p != NULL && l > 0)
+		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
+
+#ifdef CONFIG_CMDLINE
+#ifndef CONFIG_CMDLINE_FORCE
+	if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
+#endif
+		strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#endif /* CONFIG_CMDLINE */
+
+	early_init_dt_scan_chosen_arch(node);
+
+	pr_debug("Command line is: %s\n", cmd_line);
+
+	/* break now */
+	return 1;
+}
+
 /**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index d1a37e5..8118d45 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -71,6 +71,9 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
 				 unsigned long *size);
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern unsigned long of_get_flat_dt_root(void);
+extern void early_init_dt_scan_chosen_arch(unsigned long node);
+extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
+				     int depth, void *data);
 extern void early_init_dt_check_for_initrd(unsigned long node);
 extern u64 dt_mem_next_cell(int s, u32 **cellp);
 

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

* [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree()
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-24  8:19   ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between Microblaze and PowerPC

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   53 +++--------------------
 arch/powerpc/kernel/prom.c    |   94 +++--------------------------------------
 drivers/of/fdt.c              |   92 ++++++++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    7 +++
 4 files changed, 115 insertions(+), 131 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 7ee021f..543465a 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -47,9 +47,8 @@ struct device_node *of_chosen;
 
 #define early_init_dt_scan_drconf_memory(node) 0
 
-static int __init early_init_dt_scan_cpus(unsigned long node,
-					  const char *uname, int depth,
-					  void *data)
+int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
+				   int depth, void *data)
 {
 	static int logical_cpuid;
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
@@ -113,8 +112,8 @@ void __init early_init_dt_scan_chosen_arch(unsigned long node)
 	/* No Microblaze specific code here */
 }
 
-static int __init early_init_dt_scan_memory(unsigned long node,
-				const char *uname, int depth, void *data)
+int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
+				     int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
 	u32 *reg, *endp;
@@ -201,7 +200,7 @@ static inline unsigned long phyp_dump_calculate_reserve_size(void)
  * without reserving anything. The memory in case of dump being
  * active is freed when the dump is collected (by userland tools).
  */
-static void __init phyp_dump_reserve_mem(void)
+void __init phyp_dump_reserve_mem(void)
 {
 	unsigned long base, size;
 	unsigned long variable_reserve_size;
@@ -240,7 +239,7 @@ static void __init phyp_dump_reserve_mem(void)
 	}
 }
 #else
-static inline void __init phyp_dump_reserve_mem(void) {}
+inline void __init phyp_dump_reserve_mem(void) {}
 #endif /* CONFIG_PHYP_DUMP  && CONFIG_PPC_RTAS */
 
 #ifdef CONFIG_EARLY_PRINTK
@@ -277,45 +276,9 @@ int __init early_uartlite_console(void)
 }
 #endif
 
-void __init early_init_devtree(void *params)
+void __init early_init_devtree_arch(void)
 {
-	pr_debug(" -> early_init_devtree(%p)\n", params);
-
-	/* Setup flat device-tree pointer */
-	initial_boot_params = params;
-
-#ifdef CONFIG_PHYP_DUMP
-	/* scan tree to see if dump occured during last boot */
-	of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
-#endif
-
-	/* Retrieve various informations from the /chosen node of the
-	 * device-tree, including the platform type, initrd location and
-	 * size, TCE reserve, and more ...
-	 */
-	of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
-
-	/* Scan memory nodes and rebuild LMBs */
-	lmb_init();
-	of_scan_flat_dt(early_init_dt_scan_root, NULL);
-	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
-
-	/* Save command line for /proc/cmdline and then parse parameters */
-	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
-	parse_early_param();
-
-	lmb_analyze();
-
-	pr_debug("Phys. mem: %lx\n", (unsigned long) lmb_phys_mem_size());
-
-	pr_debug("Scanning CPUs ...\n");
-
-	/* Retreive CPU related informations from the flat tree
-	 * (altivec support, boot CPU ID, ...)
-	 */
-	of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
-
-	pr_debug(" <- early_init_devtree()\n");
+	/* No Microblaze specific code here */
 }
 
 /**
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 2c7d4a3..a5b3b9d 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -84,33 +84,6 @@ static int __init early_parse_mem(char *p)
 }
 early_param("mem", early_parse_mem);
 
-/**
- * move_device_tree - move tree to an unused area, if needed.
- *
- * The device tree may be allocated beyond our memory limit, or inside the
- * crash kernel region for kdump. If so, move it out of the way.
- */
-static void __init move_device_tree(void)
-{
-	unsigned long start, size;
-	void *p;
-
-	DBG("-> move_device_tree\n");
-
-	start = __pa(initial_boot_params);
-	size = initial_boot_params->totalsize;
-
-	if ((memory_limit && (start + size) > memory_limit) ||
-			overlaps_crashkernel(start, size)) {
-		p = __va(lmb_alloc_base(size, PAGE_SIZE, lmb.rmo_size));
-		memcpy(p, initial_boot_params, size);
-		initial_boot_params = (struct boot_param_header *)p;
-		DBG("Moved device tree to 0x%p\n", p);
-	}
-
-	DBG("<- move_device_tree\n");
-}
-
 /*
  * ibm,pa-features is a per-cpu property that contains a string of
  * attribute descriptors, each of which has a 2 byte header plus up
@@ -267,9 +240,8 @@ static void __init check_cpu_feature_properties(unsigned long node)
 	}
 }
 
-static int __init early_init_dt_scan_cpus(unsigned long node,
-					  const char *uname, int depth,
-					  void *data)
+int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
+				   int depth, void *data)
 {
 	static int logical_cpuid = 0;
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
@@ -483,8 +455,8 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
 #define early_init_dt_scan_drconf_memory(node)	0
 #endif /* CONFIG_PPC_PSERIES */
 
-static int __init early_init_dt_scan_memory(unsigned long node,
-					    const char *uname, int depth, void *data)
+int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
+				     int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
 	u32 *reg, *endp;
@@ -543,7 +515,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 	return 0;
 }
 
-static void __init early_reserve_mem(void)
+void __init early_reserve_mem(void)
 {
 	u64 base, size;
 	u64 *reserve_map;
@@ -635,7 +607,7 @@ static inline unsigned long phyp_dump_calculate_reserve_size(void)
  * without reserving anything. The memory in case of dump being
  * active is freed when the dump is collected (by userland tools).
  */
-static void __init phyp_dump_reserve_mem(void)
+void __init phyp_dump_reserve_mem(void)
 {
 	unsigned long base, size;
 	unsigned long variable_reserve_size;
@@ -674,44 +646,13 @@ static void __init phyp_dump_reserve_mem(void)
 	}
 }
 #else
-static inline void __init phyp_dump_reserve_mem(void) {}
+inline void __init phyp_dump_reserve_mem(void) {}
 #endif /* CONFIG_PHYP_DUMP  && CONFIG_PPC_RTAS */
 
-
-void __init early_init_devtree(void *params)
+void __init early_init_devtree_arch(void)
 {
 	phys_addr_t limit;
 
-	DBG(" -> early_init_devtree(%p)\n", params);
-
-	/* Setup flat device-tree pointer */
-	initial_boot_params = params;
-
-#ifdef CONFIG_PPC_RTAS
-	/* Some machines might need RTAS info for debugging, grab it now. */
-	of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
-#endif
-
-#ifdef CONFIG_PHYP_DUMP
-	/* scan tree to see if dump occured during last boot */
-	of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
-#endif
-
-	/* Retrieve various informations from the /chosen node of the
-	 * device-tree, including the platform type, initrd location and
-	 * size, TCE reserve, and more ...
-	 */
-	of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
-
-	/* Scan memory nodes and rebuild LMBs */
-	lmb_init();
-	of_scan_flat_dt(early_init_dt_scan_root, NULL);
-	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
-
-	/* Save command line for /proc/cmdline and then parse parameters */
-	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
-	parse_early_param();
-
 	/* Reserve LMB regions used by kernel, initrd, dt, etc... */
 	lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
 	/* If relocatable, reserve first 32k for interrupt vectors etc. */
@@ -734,27 +675,8 @@ void __init early_init_devtree(void *params)
 			limit = memsize & PAGE_MASK;
 	}
 	lmb_enforce_memory_limit(limit);
-
-	lmb_analyze();
-	lmb_dump_all();
-
-	DBG("Phys. mem: %llx\n", lmb_phys_mem_size());
-
-	/* We may need to relocate the flat tree, do it now.
-	 * FIXME .. and the initrd too? */
-	move_device_tree();
-
-	DBG("Scanning CPUs ...\n");
-
-	/* Retreive CPU related informations from the flat tree
-	 * (altivec support, boot CPU ID, ...)
-	 */
-	of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
-
-	DBG(" <- early_init_devtree()\n");
 }
 
-
 /**
  * Indicates whether the root node has a given value in its
  * compatible property.
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 616a476..6164781 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -16,7 +16,12 @@
 #include <linux/of_fdt.h>
 
 #ifdef CONFIG_PPC
+#include <asm/kexec.h>
 #include <asm/machdep.h>
+
+#ifdef CONFIG_PPC_RTAS
+#include <asm/rtas.h>
+#endif
 #endif /* CONFIG_PPC */
 
 int __initdata dt_root_addr_cells;
@@ -479,6 +484,93 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
 }
 
 /**
+ * early_init_move_devtree - move tree to an unused area, if needed.
+ *
+ * The device tree may be allocated beyond our memory limit, or inside the
+ * crash kernel region for kdump. If so, move it out of the way.
+ */
+#if defined(CONFIG_PPC)
+static void __init early_init_move_devtree(void)
+{
+	unsigned long start, size;
+	void *p;
+
+	pr_debug("-> %s()\n", __func__);
+
+	start = __pa(initial_boot_params);
+	size = initial_boot_params->totalsize;
+
+	if ((memory_limit && (start + size) > memory_limit) ||
+			overlaps_crashkernel(start, size)) {
+		p = __va(lmb_alloc_base(size, PAGE_SIZE, lmb.rmo_size));
+		memcpy(p, initial_boot_params, size);
+		initial_boot_params = (struct boot_param_header *)p;
+		pr_debug("Moved device tree to 0x%p\n", p);
+	}
+
+	pr_debug("<- %s()\n", __func__);
+}
+#else
+static void __init early_init_move_devtree(void) {}
+#endif
+
+void __init early_init_devtree(void *params)
+{
+	pr_debug(" -> early_init_devtree(%p)\n", params);
+
+	/* Setup flat device-tree pointer */
+	initial_boot_params = params;
+
+#ifdef CONFIG_PPC_RTAS
+	/* Some machines might need RTAS info for debugging, grab it now. */
+	of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
+#endif
+
+#ifdef CONFIG_PHYP_DUMP
+	/* scan tree to see if dump occured during last boot */
+	of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
+#endif
+
+	/* Retrieve various informations from the /chosen node of the
+	 * device-tree, including the platform type, initrd location and
+	 * size, TCE reserve, and more ...
+	 */
+	of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
+
+	/* Scan memory nodes and rebuild LMBs */
+	lmb_init();
+	of_scan_flat_dt(early_init_dt_scan_root, NULL);
+	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
+
+	/* Save command line for /proc/cmdline and then parse parameters */
+	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
+	parse_early_param();
+
+	/* This is in an arbitrary spot, but it is temporary.  After all
+	 * the common code is merged, the structure of the early init
+	 * code will be reevaluated and refactored */
+	early_init_devtree_arch();
+
+	lmb_analyze();
+	lmb_dump_all();
+
+	pr_debug("Phys. mem: %llx\n", lmb_phys_mem_size());
+
+	/* We may need to relocate the flat tree, do it now.
+	 * FIXME .. and the initrd too? */
+	early_init_move_devtree();
+
+	pr_debug("Scanning CPUs ...\n");
+
+	/* Retreive CPU related informations from the flat tree
+	 * (altivec support, boot CPU ID, ...)
+	 */
+	of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
+
+	pr_debug(" <- early_init_devtree()\n");
+}
+
+/**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
  * unflattens the device-tree passed by the firmware, creating the
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 8118d45..d1b1571 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -75,6 +75,13 @@ extern void early_init_dt_scan_chosen_arch(unsigned long node);
 extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
 				     int depth, void *data);
 extern void early_init_dt_check_for_initrd(unsigned long node);
+extern int early_init_dt_scan_cpus(unsigned long node, const char *uname,
+				   int depth, void *data);
+extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
+				     int depth, void *data);
+extern void early_reserve_mem(void);
+extern void early_init_devtree_arch(void);
+extern void phyp_dump_reserve_mem(void);
 extern u64 dt_mem_next_cell(int s, u32 **cellp);
 
 /* Early flat tree scan hooks */


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

* [PATCH 06/11] of/flattree: merge early_init_devtree() and
@ 2009-11-24  8:19   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between Microblaze and PowerPC

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   53 +++--------------------
 arch/powerpc/kernel/prom.c    |   94 +++--------------------------------------
 drivers/of/fdt.c              |   92 ++++++++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    7 +++
 4 files changed, 115 insertions(+), 131 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 7ee021f..543465a 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -47,9 +47,8 @@ struct device_node *of_chosen;
 
 #define early_init_dt_scan_drconf_memory(node) 0
 
-static int __init early_init_dt_scan_cpus(unsigned long node,
-					  const char *uname, int depth,
-					  void *data)
+int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
+				   int depth, void *data)
 {
 	static int logical_cpuid;
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
@@ -113,8 +112,8 @@ void __init early_init_dt_scan_chosen_arch(unsigned long node)
 	/* No Microblaze specific code here */
 }
 
-static int __init early_init_dt_scan_memory(unsigned long node,
-				const char *uname, int depth, void *data)
+int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
+				     int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
 	u32 *reg, *endp;
@@ -201,7 +200,7 @@ static inline unsigned long phyp_dump_calculate_reserve_size(void)
  * without reserving anything. The memory in case of dump being
  * active is freed when the dump is collected (by userland tools).
  */
-static void __init phyp_dump_reserve_mem(void)
+void __init phyp_dump_reserve_mem(void)
 {
 	unsigned long base, size;
 	unsigned long variable_reserve_size;
@@ -240,7 +239,7 @@ static void __init phyp_dump_reserve_mem(void)
 	}
 }
 #else
-static inline void __init phyp_dump_reserve_mem(void) {}
+inline void __init phyp_dump_reserve_mem(void) {}
 #endif /* CONFIG_PHYP_DUMP  && CONFIG_PPC_RTAS */
 
 #ifdef CONFIG_EARLY_PRINTK
@@ -277,45 +276,9 @@ int __init early_uartlite_console(void)
 }
 #endif
 
-void __init early_init_devtree(void *params)
+void __init early_init_devtree_arch(void)
 {
-	pr_debug(" -> early_init_devtree(%p)\n", params);
-
-	/* Setup flat device-tree pointer */
-	initial_boot_params = params;
-
-#ifdef CONFIG_PHYP_DUMP
-	/* scan tree to see if dump occured during last boot */
-	of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
-#endif
-
-	/* Retrieve various informations from the /chosen node of the
-	 * device-tree, including the platform type, initrd location and
-	 * size, TCE reserve, and more ...
-	 */
-	of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
-
-	/* Scan memory nodes and rebuild LMBs */
-	lmb_init();
-	of_scan_flat_dt(early_init_dt_scan_root, NULL);
-	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
-
-	/* Save command line for /proc/cmdline and then parse parameters */
-	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
-	parse_early_param();
-
-	lmb_analyze();
-
-	pr_debug("Phys. mem: %lx\n", (unsigned long) lmb_phys_mem_size());
-
-	pr_debug("Scanning CPUs ...\n");
-
-	/* Retreive CPU related informations from the flat tree
-	 * (altivec support, boot CPU ID, ...)
-	 */
-	of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
-
-	pr_debug(" <- early_init_devtree()\n");
+	/* No Microblaze specific code here */
 }
 
 /**
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 2c7d4a3..a5b3b9d 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -84,33 +84,6 @@ static int __init early_parse_mem(char *p)
 }
 early_param("mem", early_parse_mem);
 
-/**
- * move_device_tree - move tree to an unused area, if needed.
- *
- * The device tree may be allocated beyond our memory limit, or inside the
- * crash kernel region for kdump. If so, move it out of the way.
- */
-static void __init move_device_tree(void)
-{
-	unsigned long start, size;
-	void *p;
-
-	DBG("-> move_device_tree\n");
-
-	start = __pa(initial_boot_params);
-	size = initial_boot_params->totalsize;
-
-	if ((memory_limit && (start + size) > memory_limit) ||
-			overlaps_crashkernel(start, size)) {
-		p = __va(lmb_alloc_base(size, PAGE_SIZE, lmb.rmo_size));
-		memcpy(p, initial_boot_params, size);
-		initial_boot_params = (struct boot_param_header *)p;
-		DBG("Moved device tree to 0x%p\n", p);
-	}
-
-	DBG("<- move_device_tree\n");
-}
-
 /*
  * ibm,pa-features is a per-cpu property that contains a string of
  * attribute descriptors, each of which has a 2 byte header plus up
@@ -267,9 +240,8 @@ static void __init check_cpu_feature_properties(unsigned long node)
 	}
 }
 
-static int __init early_init_dt_scan_cpus(unsigned long node,
-					  const char *uname, int depth,
-					  void *data)
+int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
+				   int depth, void *data)
 {
 	static int logical_cpuid = 0;
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
@@ -483,8 +455,8 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
 #define early_init_dt_scan_drconf_memory(node)	0
 #endif /* CONFIG_PPC_PSERIES */
 
-static int __init early_init_dt_scan_memory(unsigned long node,
-					    const char *uname, int depth, void *data)
+int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
+				     int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
 	u32 *reg, *endp;
@@ -543,7 +515,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 	return 0;
 }
 
-static void __init early_reserve_mem(void)
+void __init early_reserve_mem(void)
 {
 	u64 base, size;
 	u64 *reserve_map;
@@ -635,7 +607,7 @@ static inline unsigned long phyp_dump_calculate_reserve_size(void)
  * without reserving anything. The memory in case of dump being
  * active is freed when the dump is collected (by userland tools).
  */
-static void __init phyp_dump_reserve_mem(void)
+void __init phyp_dump_reserve_mem(void)
 {
 	unsigned long base, size;
 	unsigned long variable_reserve_size;
@@ -674,44 +646,13 @@ static void __init phyp_dump_reserve_mem(void)
 	}
 }
 #else
-static inline void __init phyp_dump_reserve_mem(void) {}
+inline void __init phyp_dump_reserve_mem(void) {}
 #endif /* CONFIG_PHYP_DUMP  && CONFIG_PPC_RTAS */
 
-
-void __init early_init_devtree(void *params)
+void __init early_init_devtree_arch(void)
 {
 	phys_addr_t limit;
 
-	DBG(" -> early_init_devtree(%p)\n", params);
-
-	/* Setup flat device-tree pointer */
-	initial_boot_params = params;
-
-#ifdef CONFIG_PPC_RTAS
-	/* Some machines might need RTAS info for debugging, grab it now. */
-	of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
-#endif
-
-#ifdef CONFIG_PHYP_DUMP
-	/* scan tree to see if dump occured during last boot */
-	of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
-#endif
-
-	/* Retrieve various informations from the /chosen node of the
-	 * device-tree, including the platform type, initrd location and
-	 * size, TCE reserve, and more ...
-	 */
-	of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
-
-	/* Scan memory nodes and rebuild LMBs */
-	lmb_init();
-	of_scan_flat_dt(early_init_dt_scan_root, NULL);
-	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
-
-	/* Save command line for /proc/cmdline and then parse parameters */
-	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
-	parse_early_param();
-
 	/* Reserve LMB regions used by kernel, initrd, dt, etc... */
 	lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
 	/* If relocatable, reserve first 32k for interrupt vectors etc. */
@@ -734,27 +675,8 @@ void __init early_init_devtree(void *params)
 			limit = memsize & PAGE_MASK;
 	}
 	lmb_enforce_memory_limit(limit);
-
-	lmb_analyze();
-	lmb_dump_all();
-
-	DBG("Phys. mem: %llx\n", lmb_phys_mem_size());
-
-	/* We may need to relocate the flat tree, do it now.
-	 * FIXME .. and the initrd too? */
-	move_device_tree();
-
-	DBG("Scanning CPUs ...\n");
-
-	/* Retreive CPU related informations from the flat tree
-	 * (altivec support, boot CPU ID, ...)
-	 */
-	of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
-
-	DBG(" <- early_init_devtree()\n");
 }
 
-
 /**
  * Indicates whether the root node has a given value in its
  * compatible property.
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 616a476..6164781 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -16,7 +16,12 @@
 #include <linux/of_fdt.h>
 
 #ifdef CONFIG_PPC
+#include <asm/kexec.h>
 #include <asm/machdep.h>
+
+#ifdef CONFIG_PPC_RTAS
+#include <asm/rtas.h>
+#endif
 #endif /* CONFIG_PPC */
 
 int __initdata dt_root_addr_cells;
@@ -479,6 +484,93 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
 }
 
 /**
+ * early_init_move_devtree - move tree to an unused area, if needed.
+ *
+ * The device tree may be allocated beyond our memory limit, or inside the
+ * crash kernel region for kdump. If so, move it out of the way.
+ */
+#if defined(CONFIG_PPC)
+static void __init early_init_move_devtree(void)
+{
+	unsigned long start, size;
+	void *p;
+
+	pr_debug("-> %s()\n", __func__);
+
+	start = __pa(initial_boot_params);
+	size = initial_boot_params->totalsize;
+
+	if ((memory_limit && (start + size) > memory_limit) ||
+			overlaps_crashkernel(start, size)) {
+		p = __va(lmb_alloc_base(size, PAGE_SIZE, lmb.rmo_size));
+		memcpy(p, initial_boot_params, size);
+		initial_boot_params = (struct boot_param_header *)p;
+		pr_debug("Moved device tree to 0x%p\n", p);
+	}
+
+	pr_debug("<- %s()\n", __func__);
+}
+#else
+static void __init early_init_move_devtree(void) {}
+#endif
+
+void __init early_init_devtree(void *params)
+{
+	pr_debug(" -> early_init_devtree(%p)\n", params);
+
+	/* Setup flat device-tree pointer */
+	initial_boot_params = params;
+
+#ifdef CONFIG_PPC_RTAS
+	/* Some machines might need RTAS info for debugging, grab it now. */
+	of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
+#endif
+
+#ifdef CONFIG_PHYP_DUMP
+	/* scan tree to see if dump occured during last boot */
+	of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
+#endif
+
+	/* Retrieve various informations from the /chosen node of the
+	 * device-tree, including the platform type, initrd location and
+	 * size, TCE reserve, and more ...
+	 */
+	of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
+
+	/* Scan memory nodes and rebuild LMBs */
+	lmb_init();
+	of_scan_flat_dt(early_init_dt_scan_root, NULL);
+	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
+
+	/* Save command line for /proc/cmdline and then parse parameters */
+	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
+	parse_early_param();
+
+	/* This is in an arbitrary spot, but it is temporary.  After all
+	 * the common code is merged, the structure of the early init
+	 * code will be reevaluated and refactored */
+	early_init_devtree_arch();
+
+	lmb_analyze();
+	lmb_dump_all();
+
+	pr_debug("Phys. mem: %llx\n", lmb_phys_mem_size());
+
+	/* We may need to relocate the flat tree, do it now.
+	 * FIXME .. and the initrd too? */
+	early_init_move_devtree();
+
+	pr_debug("Scanning CPUs ...\n");
+
+	/* Retreive CPU related informations from the flat tree
+	 * (altivec support, boot CPU ID, ...)
+	 */
+	of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
+
+	pr_debug(" <- early_init_devtree()\n");
+}
+
+/**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
  * unflattens the device-tree passed by the firmware, creating the
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 8118d45..d1b1571 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -75,6 +75,13 @@ extern void early_init_dt_scan_chosen_arch(unsigned long node);
 extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
 				     int depth, void *data);
 extern void early_init_dt_check_for_initrd(unsigned long node);
+extern int early_init_dt_scan_cpus(unsigned long node, const char *uname,
+				   int depth, void *data);
+extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
+				     int depth, void *data);
+extern void early_reserve_mem(void);
+extern void early_init_devtree_arch(void);
+extern void phyp_dump_reserve_mem(void);
 extern u64 dt_mem_next_cell(int s, u32 **cellp);
 
 /* Early flat tree scan hooks */


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

* [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree()
@ 2009-11-24  8:19   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

Merge common code between Microblaze and PowerPC

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   53 +++--------------------
 arch/powerpc/kernel/prom.c    |   94 +++--------------------------------------
 drivers/of/fdt.c              |   92 ++++++++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h        |    7 +++
 4 files changed, 115 insertions(+), 131 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 7ee021f..543465a 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -47,9 +47,8 @@ struct device_node *of_chosen;
 
 #define early_init_dt_scan_drconf_memory(node) 0
 
-static int __init early_init_dt_scan_cpus(unsigned long node,
-					  const char *uname, int depth,
-					  void *data)
+int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
+				   int depth, void *data)
 {
 	static int logical_cpuid;
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
@@ -113,8 +112,8 @@ void __init early_init_dt_scan_chosen_arch(unsigned long node)
 	/* No Microblaze specific code here */
 }
 
-static int __init early_init_dt_scan_memory(unsigned long node,
-				const char *uname, int depth, void *data)
+int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
+				     int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
 	u32 *reg, *endp;
@@ -201,7 +200,7 @@ static inline unsigned long phyp_dump_calculate_reserve_size(void)
  * without reserving anything. The memory in case of dump being
  * active is freed when the dump is collected (by userland tools).
  */
-static void __init phyp_dump_reserve_mem(void)
+void __init phyp_dump_reserve_mem(void)
 {
 	unsigned long base, size;
 	unsigned long variable_reserve_size;
@@ -240,7 +239,7 @@ static void __init phyp_dump_reserve_mem(void)
 	}
 }
 #else
-static inline void __init phyp_dump_reserve_mem(void) {}
+inline void __init phyp_dump_reserve_mem(void) {}
 #endif /* CONFIG_PHYP_DUMP  && CONFIG_PPC_RTAS */
 
 #ifdef CONFIG_EARLY_PRINTK
@@ -277,45 +276,9 @@ int __init early_uartlite_console(void)
 }
 #endif
 
-void __init early_init_devtree(void *params)
+void __init early_init_devtree_arch(void)
 {
-	pr_debug(" -> early_init_devtree(%p)\n", params);
-
-	/* Setup flat device-tree pointer */
-	initial_boot_params = params;
-
-#ifdef CONFIG_PHYP_DUMP
-	/* scan tree to see if dump occured during last boot */
-	of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
-#endif
-
-	/* Retrieve various informations from the /chosen node of the
-	 * device-tree, including the platform type, initrd location and
-	 * size, TCE reserve, and more ...
-	 */
-	of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
-
-	/* Scan memory nodes and rebuild LMBs */
-	lmb_init();
-	of_scan_flat_dt(early_init_dt_scan_root, NULL);
-	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
-
-	/* Save command line for /proc/cmdline and then parse parameters */
-	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
-	parse_early_param();
-
-	lmb_analyze();
-
-	pr_debug("Phys. mem: %lx\n", (unsigned long) lmb_phys_mem_size());
-
-	pr_debug("Scanning CPUs ...\n");
-
-	/* Retreive CPU related informations from the flat tree
-	 * (altivec support, boot CPU ID, ...)
-	 */
-	of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
-
-	pr_debug(" <- early_init_devtree()\n");
+	/* No Microblaze specific code here */
 }
 
 /**
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 2c7d4a3..a5b3b9d 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -84,33 +84,6 @@ static int __init early_parse_mem(char *p)
 }
 early_param("mem", early_parse_mem);
 
-/**
- * move_device_tree - move tree to an unused area, if needed.
- *
- * The device tree may be allocated beyond our memory limit, or inside the
- * crash kernel region for kdump. If so, move it out of the way.
- */
-static void __init move_device_tree(void)
-{
-	unsigned long start, size;
-	void *p;
-
-	DBG("-> move_device_tree\n");
-
-	start = __pa(initial_boot_params);
-	size = initial_boot_params->totalsize;
-
-	if ((memory_limit && (start + size) > memory_limit) ||
-			overlaps_crashkernel(start, size)) {
-		p = __va(lmb_alloc_base(size, PAGE_SIZE, lmb.rmo_size));
-		memcpy(p, initial_boot_params, size);
-		initial_boot_params = (struct boot_param_header *)p;
-		DBG("Moved device tree to 0x%p\n", p);
-	}
-
-	DBG("<- move_device_tree\n");
-}
-
 /*
  * ibm,pa-features is a per-cpu property that contains a string of
  * attribute descriptors, each of which has a 2 byte header plus up
@@ -267,9 +240,8 @@ static void __init check_cpu_feature_properties(unsigned long node)
 	}
 }
 
-static int __init early_init_dt_scan_cpus(unsigned long node,
-					  const char *uname, int depth,
-					  void *data)
+int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
+				   int depth, void *data)
 {
 	static int logical_cpuid = 0;
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
@@ -483,8 +455,8 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
 #define early_init_dt_scan_drconf_memory(node)	0
 #endif /* CONFIG_PPC_PSERIES */
 
-static int __init early_init_dt_scan_memory(unsigned long node,
-					    const char *uname, int depth, void *data)
+int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
+				     int depth, void *data)
 {
 	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
 	u32 *reg, *endp;
@@ -543,7 +515,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
 	return 0;
 }
 
-static void __init early_reserve_mem(void)
+void __init early_reserve_mem(void)
 {
 	u64 base, size;
 	u64 *reserve_map;
@@ -635,7 +607,7 @@ static inline unsigned long phyp_dump_calculate_reserve_size(void)
  * without reserving anything. The memory in case of dump being
  * active is freed when the dump is collected (by userland tools).
  */
-static void __init phyp_dump_reserve_mem(void)
+void __init phyp_dump_reserve_mem(void)
 {
 	unsigned long base, size;
 	unsigned long variable_reserve_size;
@@ -674,44 +646,13 @@ static void __init phyp_dump_reserve_mem(void)
 	}
 }
 #else
-static inline void __init phyp_dump_reserve_mem(void) {}
+inline void __init phyp_dump_reserve_mem(void) {}
 #endif /* CONFIG_PHYP_DUMP  && CONFIG_PPC_RTAS */
 
-
-void __init early_init_devtree(void *params)
+void __init early_init_devtree_arch(void)
 {
 	phys_addr_t limit;
 
-	DBG(" -> early_init_devtree(%p)\n", params);
-
-	/* Setup flat device-tree pointer */
-	initial_boot_params = params;
-
-#ifdef CONFIG_PPC_RTAS
-	/* Some machines might need RTAS info for debugging, grab it now. */
-	of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
-#endif
-
-#ifdef CONFIG_PHYP_DUMP
-	/* scan tree to see if dump occured during last boot */
-	of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
-#endif
-
-	/* Retrieve various informations from the /chosen node of the
-	 * device-tree, including the platform type, initrd location and
-	 * size, TCE reserve, and more ...
-	 */
-	of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
-
-	/* Scan memory nodes and rebuild LMBs */
-	lmb_init();
-	of_scan_flat_dt(early_init_dt_scan_root, NULL);
-	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
-
-	/* Save command line for /proc/cmdline and then parse parameters */
-	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
-	parse_early_param();
-
 	/* Reserve LMB regions used by kernel, initrd, dt, etc... */
 	lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
 	/* If relocatable, reserve first 32k for interrupt vectors etc. */
@@ -734,27 +675,8 @@ void __init early_init_devtree(void *params)
 			limit = memsize & PAGE_MASK;
 	}
 	lmb_enforce_memory_limit(limit);
-
-	lmb_analyze();
-	lmb_dump_all();
-
-	DBG("Phys. mem: %llx\n", lmb_phys_mem_size());
-
-	/* We may need to relocate the flat tree, do it now.
-	 * FIXME .. and the initrd too? */
-	move_device_tree();
-
-	DBG("Scanning CPUs ...\n");
-
-	/* Retreive CPU related informations from the flat tree
-	 * (altivec support, boot CPU ID, ...)
-	 */
-	of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
-
-	DBG(" <- early_init_devtree()\n");
 }
 
-
 /**
  * Indicates whether the root node has a given value in its
  * compatible property.
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 616a476..6164781 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -16,7 +16,12 @@
 #include <linux/of_fdt.h>
 
 #ifdef CONFIG_PPC
+#include <asm/kexec.h>
 #include <asm/machdep.h>
+
+#ifdef CONFIG_PPC_RTAS
+#include <asm/rtas.h>
+#endif
 #endif /* CONFIG_PPC */
 
 int __initdata dt_root_addr_cells;
@@ -479,6 +484,93 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
 }
 
 /**
+ * early_init_move_devtree - move tree to an unused area, if needed.
+ *
+ * The device tree may be allocated beyond our memory limit, or inside the
+ * crash kernel region for kdump. If so, move it out of the way.
+ */
+#if defined(CONFIG_PPC)
+static void __init early_init_move_devtree(void)
+{
+	unsigned long start, size;
+	void *p;
+
+	pr_debug("-> %s()\n", __func__);
+
+	start = __pa(initial_boot_params);
+	size = initial_boot_params->totalsize;
+
+	if ((memory_limit && (start + size) > memory_limit) ||
+			overlaps_crashkernel(start, size)) {
+		p = __va(lmb_alloc_base(size, PAGE_SIZE, lmb.rmo_size));
+		memcpy(p, initial_boot_params, size);
+		initial_boot_params = (struct boot_param_header *)p;
+		pr_debug("Moved device tree to 0x%p\n", p);
+	}
+
+	pr_debug("<- %s()\n", __func__);
+}
+#else
+static void __init early_init_move_devtree(void) {}
+#endif
+
+void __init early_init_devtree(void *params)
+{
+	pr_debug(" -> early_init_devtree(%p)\n", params);
+
+	/* Setup flat device-tree pointer */
+	initial_boot_params = params;
+
+#ifdef CONFIG_PPC_RTAS
+	/* Some machines might need RTAS info for debugging, grab it now. */
+	of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
+#endif
+
+#ifdef CONFIG_PHYP_DUMP
+	/* scan tree to see if dump occured during last boot */
+	of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
+#endif
+
+	/* Retrieve various informations from the /chosen node of the
+	 * device-tree, including the platform type, initrd location and
+	 * size, TCE reserve, and more ...
+	 */
+	of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
+
+	/* Scan memory nodes and rebuild LMBs */
+	lmb_init();
+	of_scan_flat_dt(early_init_dt_scan_root, NULL);
+	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
+
+	/* Save command line for /proc/cmdline and then parse parameters */
+	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
+	parse_early_param();
+
+	/* This is in an arbitrary spot, but it is temporary.  After all
+	 * the common code is merged, the structure of the early init
+	 * code will be reevaluated and refactored */
+	early_init_devtree_arch();
+
+	lmb_analyze();
+	lmb_dump_all();
+
+	pr_debug("Phys. mem: %llx\n", lmb_phys_mem_size());
+
+	/* We may need to relocate the flat tree, do it now.
+	 * FIXME .. and the initrd too? */
+	early_init_move_devtree();
+
+	pr_debug("Scanning CPUs ...\n");
+
+	/* Retreive CPU related informations from the flat tree
+	 * (altivec support, boot CPU ID, ...)
+	 */
+	of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
+
+	pr_debug(" <- early_init_devtree()\n");
+}
+
+/**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
  * unflattens the device-tree passed by the firmware, creating the
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 8118d45..d1b1571 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -75,6 +75,13 @@ extern void early_init_dt_scan_chosen_arch(unsigned long node);
 extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
 				     int depth, void *data);
 extern void early_init_dt_check_for_initrd(unsigned long node);
+extern int early_init_dt_scan_cpus(unsigned long node, const char *uname,
+				   int depth, void *data);
+extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
+				     int depth, void *data);
+extern void early_reserve_mem(void);
+extern void early_init_devtree_arch(void);
+extern void phyp_dump_reserve_mem(void);
 extern u64 dt_mem_next_cell(int s, u32 **cellp);
 
 /* Early flat tree scan hooks */

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

* [PATCH 07/11] of: merge machine_is_compatible()
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-24  8:19   ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   18 ------------------
 arch/powerpc/kernel/prom.c    |   18 ------------------
 drivers/of/base.c             |   18 ++++++++++++++++++
 3 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 543465a..c97192d 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -281,24 +281,6 @@ void __init early_init_devtree_arch(void)
 	/* No Microblaze specific code here */
 }
 
-/**
- * Indicates whether the root node has a given value in its
- * compatible property.
- */
-int machine_is_compatible(const char *compat)
-{
-	struct device_node *root;
-	int rc = 0;
-
-	root = of_find_node_by_path("/");
-	if (root) {
-		rc = of_device_is_compatible(root, compat);
-		of_node_put(root);
-	}
-	return rc;
-}
-EXPORT_SYMBOL(machine_is_compatible);
-
 /*******
  *
  * New implementation of the OF "find" APIs, return a refcounted
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index a5b3b9d..65de093 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -677,24 +677,6 @@ void __init early_init_devtree_arch(void)
 	lmb_enforce_memory_limit(limit);
 }
 
-/**
- * Indicates whether the root node has a given value in its
- * compatible property.
- */
-int machine_is_compatible(const char *compat)
-{
-	struct device_node *root;
-	int rc = 0;
-
-	root = of_find_node_by_path("/");
-	if (root) {
-		rc = of_device_is_compatible(root, compat);
-		of_node_put(root);
-	}
-	return rc;
-}
-EXPORT_SYMBOL(machine_is_compatible);
-
 /*******
  *
  * New implementation of the OF "find" APIs, return a refcounted
diff --git a/drivers/of/base.c b/drivers/of/base.c
index ec56739..e81558f 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -144,6 +144,24 @@ int of_device_is_compatible(const struct device_node *device,
 EXPORT_SYMBOL(of_device_is_compatible);
 
 /**
+ * Indicates whether the root node has a given value in its
+ * compatible property.
+ */
+int machine_is_compatible(const char *compat)
+{
+	struct device_node *root;
+	int rc = 0;
+
+	root = of_find_node_by_path("/");
+	if (root) {
+		rc = of_device_is_compatible(root, compat);
+		of_node_put(root);
+	}
+	return rc;
+}
+EXPORT_SYMBOL(machine_is_compatible);
+
+/**
  *  of_device_is_available - check if a device is available for use
  *
  *  @device: Node to check for availability


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

* [PATCH 07/11] of: merge machine_is_compatible()
@ 2009-11-24  8:19   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   18 ------------------
 arch/powerpc/kernel/prom.c    |   18 ------------------
 drivers/of/base.c             |   18 ++++++++++++++++++
 3 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 543465a..c97192d 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -281,24 +281,6 @@ void __init early_init_devtree_arch(void)
 	/* No Microblaze specific code here */
 }
 
-/**
- * Indicates whether the root node has a given value in its
- * compatible property.
- */
-int machine_is_compatible(const char *compat)
-{
-	struct device_node *root;
-	int rc = 0;
-
-	root = of_find_node_by_path("/");
-	if (root) {
-		rc = of_device_is_compatible(root, compat);
-		of_node_put(root);
-	}
-	return rc;
-}
-EXPORT_SYMBOL(machine_is_compatible);
-
 /*******
  *
  * New implementation of the OF "find" APIs, return a refcounted
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index a5b3b9d..65de093 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -677,24 +677,6 @@ void __init early_init_devtree_arch(void)
 	lmb_enforce_memory_limit(limit);
 }
 
-/**
- * Indicates whether the root node has a given value in its
- * compatible property.
- */
-int machine_is_compatible(const char *compat)
-{
-	struct device_node *root;
-	int rc = 0;
-
-	root = of_find_node_by_path("/");
-	if (root) {
-		rc = of_device_is_compatible(root, compat);
-		of_node_put(root);
-	}
-	return rc;
-}
-EXPORT_SYMBOL(machine_is_compatible);
-
 /*******
  *
  * New implementation of the OF "find" APIs, return a refcounted
diff --git a/drivers/of/base.c b/drivers/of/base.c
index ec56739..e81558f 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -144,6 +144,24 @@ int of_device_is_compatible(const struct device_node *device,
 EXPORT_SYMBOL(of_device_is_compatible);
 
 /**
+ * Indicates whether the root node has a given value in its
+ * compatible property.
+ */
+int machine_is_compatible(const char *compat)
+{
+	struct device_node *root;
+	int rc = 0;
+
+	root = of_find_node_by_path("/");
+	if (root) {
+		rc = of_device_is_compatible(root, compat);
+		of_node_put(root);
+	}
+	return rc;
+}
+EXPORT_SYMBOL(machine_is_compatible);
+
+/**
  *  of_device_is_available - check if a device is available for use
  *
  *  @device: Node to check for availability


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

* [PATCH 07/11] of: merge machine_is_compatible()
@ 2009-11-24  8:19   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   18 ------------------
 arch/powerpc/kernel/prom.c    |   18 ------------------
 drivers/of/base.c             |   18 ++++++++++++++++++
 3 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 543465a..c97192d 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -281,24 +281,6 @@ void __init early_init_devtree_arch(void)
 	/* No Microblaze specific code here */
 }
 
-/**
- * Indicates whether the root node has a given value in its
- * compatible property.
- */
-int machine_is_compatible(const char *compat)
-{
-	struct device_node *root;
-	int rc = 0;
-
-	root = of_find_node_by_path("/");
-	if (root) {
-		rc = of_device_is_compatible(root, compat);
-		of_node_put(root);
-	}
-	return rc;
-}
-EXPORT_SYMBOL(machine_is_compatible);
-
 /*******
  *
  * New implementation of the OF "find" APIs, return a refcounted
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index a5b3b9d..65de093 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -677,24 +677,6 @@ void __init early_init_devtree_arch(void)
 	lmb_enforce_memory_limit(limit);
 }
 
-/**
- * Indicates whether the root node has a given value in its
- * compatible property.
- */
-int machine_is_compatible(const char *compat)
-{
-	struct device_node *root;
-	int rc = 0;
-
-	root = of_find_node_by_path("/");
-	if (root) {
-		rc = of_device_is_compatible(root, compat);
-		of_node_put(root);
-	}
-	return rc;
-}
-EXPORT_SYMBOL(machine_is_compatible);
-
 /*******
  *
  * New implementation of the OF "find" APIs, return a refcounted
diff --git a/drivers/of/base.c b/drivers/of/base.c
index ec56739..e81558f 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -144,6 +144,24 @@ int of_device_is_compatible(const struct device_node *device,
 EXPORT_SYMBOL(of_device_is_compatible);
 
 /**
+ * Indicates whether the root node has a given value in its
+ * compatible property.
+ */
+int machine_is_compatible(const char *compat)
+{
+	struct device_node *root;
+	int rc = 0;
+
+	root = of_find_node_by_path("/");
+	if (root) {
+		rc = of_device_is_compatible(root, compat);
+		of_node_put(root);
+	}
+	return rc;
+}
+EXPORT_SYMBOL(machine_is_compatible);
+
+/**
  *  of_device_is_available - check if a device is available for use
  *
  *  @device: Node to check for availability

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

* [PATCH 08/11] of: Merge of_node_get() and of_node_put()
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-24  8:19   ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and MicroBlaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   74 ----------------------------------------
 arch/powerpc/kernel/prom.c    |   73 ----------------------------------------
 drivers/of/base.c             |   75 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 147 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index c97192d..c0d53b7 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -313,80 +313,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 }
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
-/**
- *	of_node_get - Increment refcount of a node
- *	@node:	Node to inc refcount, NULL is supported to
- *		simplify writing of callers
- *
- *	Returns node.
- */
-struct device_node *of_node_get(struct device_node *node)
-{
-	if (node)
-		kref_get(&node->kref);
-	return node;
-}
-EXPORT_SYMBOL(of_node_get);
-
-static inline struct device_node *kref_to_device_node(struct kref *kref)
-{
-	return container_of(kref, struct device_node, kref);
-}
-
-/**
- *	of_node_release - release a dynamically allocated node
- *	@kref:  kref element of the node to be released
- *
- *	In of_node_put() this function is passed to kref_put()
- *	as the destructor.
- */
-static void of_node_release(struct kref *kref)
-{
-	struct device_node *node = kref_to_device_node(kref);
-	struct property *prop = node->properties;
-
-	/* We should never be releasing nodes that haven't been detached. */
-	if (!of_node_check_flag(node, OF_DETACHED)) {
-		printk(KERN_INFO "WARNING: Bad of_node_put() on %s\n",
-			node->full_name);
-		dump_stack();
-		kref_init(&node->kref);
-		return;
-	}
-
-	if (!of_node_check_flag(node, OF_DYNAMIC))
-		return;
-
-	while (prop) {
-		struct property *next = prop->next;
-		kfree(prop->name);
-		kfree(prop->value);
-		kfree(prop);
-		prop = next;
-
-		if (!prop) {
-			prop = node->deadprops;
-			node->deadprops = NULL;
-		}
-	}
-	kfree(node->full_name);
-	kfree(node->data);
-	kfree(node);
-}
-
-/**
- *	of_node_put - Decrement refcount of a node
- *	@node:	Node to dec refcount, NULL is supported to
- *		simplify writing of callers
- *
- */
-void of_node_put(struct device_node *node)
-{
-	if (node)
-		kref_put(&node->kref, of_node_release);
-}
-EXPORT_SYMBOL(of_node_put);
-
 /*
  * Plug a device node into the tree and global list.
  */
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 65de093..6873db9 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -740,79 +740,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
 	return NULL;
 }
 
-/**
- *	of_node_get - Increment refcount of a node
- *	@node:	Node to inc refcount, NULL is supported to
- *		simplify writing of callers
- *
- *	Returns node.
- */
-struct device_node *of_node_get(struct device_node *node)
-{
-	if (node)
-		kref_get(&node->kref);
-	return node;
-}
-EXPORT_SYMBOL(of_node_get);
-
-static inline struct device_node * kref_to_device_node(struct kref *kref)
-{
-	return container_of(kref, struct device_node, kref);
-}
-
-/**
- *	of_node_release - release a dynamically allocated node
- *	@kref:  kref element of the node to be released
- *
- *	In of_node_put() this function is passed to kref_put()
- *	as the destructor.
- */
-static void of_node_release(struct kref *kref)
-{
-	struct device_node *node = kref_to_device_node(kref);
-	struct property *prop = node->properties;
-
-	/* We should never be releasing nodes that haven't been detached. */
-	if (!of_node_check_flag(node, OF_DETACHED)) {
-		printk("WARNING: Bad of_node_put() on %s\n", node->full_name);
-		dump_stack();
-		kref_init(&node->kref);
-		return;
-	}
-
-	if (!of_node_check_flag(node, OF_DYNAMIC))
-		return;
-
-	while (prop) {
-		struct property *next = prop->next;
-		kfree(prop->name);
-		kfree(prop->value);
-		kfree(prop);
-		prop = next;
-
-		if (!prop) {
-			prop = node->deadprops;
-			node->deadprops = NULL;
-		}
-	}
-	kfree(node->full_name);
-	kfree(node->data);
-	kfree(node);
-}
-
-/**
- *	of_node_put - Decrement refcount of a node
- *	@node:	Node to dec refcount, NULL is supported to
- *		simplify writing of callers
- *
- */
-void of_node_put(struct device_node *node)
-{
-	if (node)
-		kref_put(&node->kref, of_node_release);
-}
-EXPORT_SYMBOL(of_node_put);
-
 /*
  * Plug a device node into the tree and global list.
  */
diff --git a/drivers/of/base.c b/drivers/of/base.c
index e81558f..4b10c89 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -60,6 +60,81 @@ int of_n_size_cells(struct device_node *np)
 }
 EXPORT_SYMBOL(of_n_size_cells);
 
+#if !defined(CONFIG_SPARC)   /* SPARC doesn't do ref counting (yet) */
+/**
+ *	of_node_get - Increment refcount of a node
+ *	@node:	Node to inc refcount, NULL is supported to
+ *		simplify writing of callers
+ *
+ *	Returns node.
+ */
+struct device_node *of_node_get(struct device_node *node)
+{
+	if (node)
+		kref_get(&node->kref);
+	return node;
+}
+EXPORT_SYMBOL(of_node_get);
+
+static inline struct device_node *kref_to_device_node(struct kref *kref)
+{
+	return container_of(kref, struct device_node, kref);
+}
+
+/**
+ *	of_node_release - release a dynamically allocated node
+ *	@kref:  kref element of the node to be released
+ *
+ *	In of_node_put() this function is passed to kref_put()
+ *	as the destructor.
+ */
+static void of_node_release(struct kref *kref)
+{
+	struct device_node *node = kref_to_device_node(kref);
+	struct property *prop = node->properties;
+
+	/* We should never be releasing nodes that haven't been detached. */
+	if (!of_node_check_flag(node, OF_DETACHED)) {
+		pr_err("ERROR: Bad of_node_put() on %s\n", node->full_name);
+		dump_stack();
+		kref_init(&node->kref);
+		return;
+	}
+
+	if (!of_node_check_flag(node, OF_DYNAMIC))
+		return;
+
+	while (prop) {
+		struct property *next = prop->next;
+		kfree(prop->name);
+		kfree(prop->value);
+		kfree(prop);
+		prop = next;
+
+		if (!prop) {
+			prop = node->deadprops;
+			node->deadprops = NULL;
+		}
+	}
+	kfree(node->full_name);
+	kfree(node->data);
+	kfree(node);
+}
+
+/**
+ *	of_node_put - Decrement refcount of a node
+ *	@node:	Node to dec refcount, NULL is supported to
+ *		simplify writing of callers
+ *
+ */
+void of_node_put(struct device_node *node)
+{
+	if (node)
+		kref_put(&node->kref, of_node_release);
+}
+EXPORT_SYMBOL(of_node_put);
+#endif /* !CONFIG_SPARC */
+
 struct property *of_find_property(const struct device_node *np,
 				  const char *name,
 				  int *lenp)


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

* [PATCH 08/11] of: Merge of_node_get() and of_node_put()
@ 2009-11-24  8:19   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and MicroBlaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   74 ----------------------------------------
 arch/powerpc/kernel/prom.c    |   73 ----------------------------------------
 drivers/of/base.c             |   75 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 147 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index c97192d..c0d53b7 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -313,80 +313,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 }
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
-/**
- *	of_node_get - Increment refcount of a node
- *	@node:	Node to inc refcount, NULL is supported to
- *		simplify writing of callers
- *
- *	Returns node.
- */
-struct device_node *of_node_get(struct device_node *node)
-{
-	if (node)
-		kref_get(&node->kref);
-	return node;
-}
-EXPORT_SYMBOL(of_node_get);
-
-static inline struct device_node *kref_to_device_node(struct kref *kref)
-{
-	return container_of(kref, struct device_node, kref);
-}
-
-/**
- *	of_node_release - release a dynamically allocated node
- *	@kref:  kref element of the node to be released
- *
- *	In of_node_put() this function is passed to kref_put()
- *	as the destructor.
- */
-static void of_node_release(struct kref *kref)
-{
-	struct device_node *node = kref_to_device_node(kref);
-	struct property *prop = node->properties;
-
-	/* We should never be releasing nodes that haven't been detached. */
-	if (!of_node_check_flag(node, OF_DETACHED)) {
-		printk(KERN_INFO "WARNING: Bad of_node_put() on %s\n",
-			node->full_name);
-		dump_stack();
-		kref_init(&node->kref);
-		return;
-	}
-
-	if (!of_node_check_flag(node, OF_DYNAMIC))
-		return;
-
-	while (prop) {
-		struct property *next = prop->next;
-		kfree(prop->name);
-		kfree(prop->value);
-		kfree(prop);
-		prop = next;
-
-		if (!prop) {
-			prop = node->deadprops;
-			node->deadprops = NULL;
-		}
-	}
-	kfree(node->full_name);
-	kfree(node->data);
-	kfree(node);
-}
-
-/**
- *	of_node_put - Decrement refcount of a node
- *	@node:	Node to dec refcount, NULL is supported to
- *		simplify writing of callers
- *
- */
-void of_node_put(struct device_node *node)
-{
-	if (node)
-		kref_put(&node->kref, of_node_release);
-}
-EXPORT_SYMBOL(of_node_put);
-
 /*
  * Plug a device node into the tree and global list.
  */
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 65de093..6873db9 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -740,79 +740,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
 	return NULL;
 }
 
-/**
- *	of_node_get - Increment refcount of a node
- *	@node:	Node to inc refcount, NULL is supported to
- *		simplify writing of callers
- *
- *	Returns node.
- */
-struct device_node *of_node_get(struct device_node *node)
-{
-	if (node)
-		kref_get(&node->kref);
-	return node;
-}
-EXPORT_SYMBOL(of_node_get);
-
-static inline struct device_node * kref_to_device_node(struct kref *kref)
-{
-	return container_of(kref, struct device_node, kref);
-}
-
-/**
- *	of_node_release - release a dynamically allocated node
- *	@kref:  kref element of the node to be released
- *
- *	In of_node_put() this function is passed to kref_put()
- *	as the destructor.
- */
-static void of_node_release(struct kref *kref)
-{
-	struct device_node *node = kref_to_device_node(kref);
-	struct property *prop = node->properties;
-
-	/* We should never be releasing nodes that haven't been detached. */
-	if (!of_node_check_flag(node, OF_DETACHED)) {
-		printk("WARNING: Bad of_node_put() on %s\n", node->full_name);
-		dump_stack();
-		kref_init(&node->kref);
-		return;
-	}
-
-	if (!of_node_check_flag(node, OF_DYNAMIC))
-		return;
-
-	while (prop) {
-		struct property *next = prop->next;
-		kfree(prop->name);
-		kfree(prop->value);
-		kfree(prop);
-		prop = next;
-
-		if (!prop) {
-			prop = node->deadprops;
-			node->deadprops = NULL;
-		}
-	}
-	kfree(node->full_name);
-	kfree(node->data);
-	kfree(node);
-}
-
-/**
- *	of_node_put - Decrement refcount of a node
- *	@node:	Node to dec refcount, NULL is supported to
- *		simplify writing of callers
- *
- */
-void of_node_put(struct device_node *node)
-{
-	if (node)
-		kref_put(&node->kref, of_node_release);
-}
-EXPORT_SYMBOL(of_node_put);
-
 /*
  * Plug a device node into the tree and global list.
  */
diff --git a/drivers/of/base.c b/drivers/of/base.c
index e81558f..4b10c89 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -60,6 +60,81 @@ int of_n_size_cells(struct device_node *np)
 }
 EXPORT_SYMBOL(of_n_size_cells);
 
+#if !defined(CONFIG_SPARC)   /* SPARC doesn't do ref counting (yet) */
+/**
+ *	of_node_get - Increment refcount of a node
+ *	@node:	Node to inc refcount, NULL is supported to
+ *		simplify writing of callers
+ *
+ *	Returns node.
+ */
+struct device_node *of_node_get(struct device_node *node)
+{
+	if (node)
+		kref_get(&node->kref);
+	return node;
+}
+EXPORT_SYMBOL(of_node_get);
+
+static inline struct device_node *kref_to_device_node(struct kref *kref)
+{
+	return container_of(kref, struct device_node, kref);
+}
+
+/**
+ *	of_node_release - release a dynamically allocated node
+ *	@kref:  kref element of the node to be released
+ *
+ *	In of_node_put() this function is passed to kref_put()
+ *	as the destructor.
+ */
+static void of_node_release(struct kref *kref)
+{
+	struct device_node *node = kref_to_device_node(kref);
+	struct property *prop = node->properties;
+
+	/* We should never be releasing nodes that haven't been detached. */
+	if (!of_node_check_flag(node, OF_DETACHED)) {
+		pr_err("ERROR: Bad of_node_put() on %s\n", node->full_name);
+		dump_stack();
+		kref_init(&node->kref);
+		return;
+	}
+
+	if (!of_node_check_flag(node, OF_DYNAMIC))
+		return;
+
+	while (prop) {
+		struct property *next = prop->next;
+		kfree(prop->name);
+		kfree(prop->value);
+		kfree(prop);
+		prop = next;
+
+		if (!prop) {
+			prop = node->deadprops;
+			node->deadprops = NULL;
+		}
+	}
+	kfree(node->full_name);
+	kfree(node->data);
+	kfree(node);
+}
+
+/**
+ *	of_node_put - Decrement refcount of a node
+ *	@node:	Node to dec refcount, NULL is supported to
+ *		simplify writing of callers
+ *
+ */
+void of_node_put(struct device_node *node)
+{
+	if (node)
+		kref_put(&node->kref, of_node_release);
+}
+EXPORT_SYMBOL(of_node_put);
+#endif /* !CONFIG_SPARC */
+
 struct property *of_find_property(const struct device_node *np,
 				  const char *name,
 				  int *lenp)


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

* [PATCH 08/11] of: Merge of_node_get() and of_node_put()
@ 2009-11-24  8:19   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

Merge common code between PowerPC and MicroBlaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   74 ----------------------------------------
 arch/powerpc/kernel/prom.c    |   73 ----------------------------------------
 drivers/of/base.c             |   75 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 147 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index c97192d..c0d53b7 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -313,80 +313,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 }
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
-/**
- *	of_node_get - Increment refcount of a node
- *	@node:	Node to inc refcount, NULL is supported to
- *		simplify writing of callers
- *
- *	Returns node.
- */
-struct device_node *of_node_get(struct device_node *node)
-{
-	if (node)
-		kref_get(&node->kref);
-	return node;
-}
-EXPORT_SYMBOL(of_node_get);
-
-static inline struct device_node *kref_to_device_node(struct kref *kref)
-{
-	return container_of(kref, struct device_node, kref);
-}
-
-/**
- *	of_node_release - release a dynamically allocated node
- *	@kref:  kref element of the node to be released
- *
- *	In of_node_put() this function is passed to kref_put()
- *	as the destructor.
- */
-static void of_node_release(struct kref *kref)
-{
-	struct device_node *node = kref_to_device_node(kref);
-	struct property *prop = node->properties;
-
-	/* We should never be releasing nodes that haven't been detached. */
-	if (!of_node_check_flag(node, OF_DETACHED)) {
-		printk(KERN_INFO "WARNING: Bad of_node_put() on %s\n",
-			node->full_name);
-		dump_stack();
-		kref_init(&node->kref);
-		return;
-	}
-
-	if (!of_node_check_flag(node, OF_DYNAMIC))
-		return;
-
-	while (prop) {
-		struct property *next = prop->next;
-		kfree(prop->name);
-		kfree(prop->value);
-		kfree(prop);
-		prop = next;
-
-		if (!prop) {
-			prop = node->deadprops;
-			node->deadprops = NULL;
-		}
-	}
-	kfree(node->full_name);
-	kfree(node->data);
-	kfree(node);
-}
-
-/**
- *	of_node_put - Decrement refcount of a node
- *	@node:	Node to dec refcount, NULL is supported to
- *		simplify writing of callers
- *
- */
-void of_node_put(struct device_node *node)
-{
-	if (node)
-		kref_put(&node->kref, of_node_release);
-}
-EXPORT_SYMBOL(of_node_put);
-
 /*
  * Plug a device node into the tree and global list.
  */
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 65de093..6873db9 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -740,79 +740,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
 	return NULL;
 }
 
-/**
- *	of_node_get - Increment refcount of a node
- *	@node:	Node to inc refcount, NULL is supported to
- *		simplify writing of callers
- *
- *	Returns node.
- */
-struct device_node *of_node_get(struct device_node *node)
-{
-	if (node)
-		kref_get(&node->kref);
-	return node;
-}
-EXPORT_SYMBOL(of_node_get);
-
-static inline struct device_node * kref_to_device_node(struct kref *kref)
-{
-	return container_of(kref, struct device_node, kref);
-}
-
-/**
- *	of_node_release - release a dynamically allocated node
- *	@kref:  kref element of the node to be released
- *
- *	In of_node_put() this function is passed to kref_put()
- *	as the destructor.
- */
-static void of_node_release(struct kref *kref)
-{
-	struct device_node *node = kref_to_device_node(kref);
-	struct property *prop = node->properties;
-
-	/* We should never be releasing nodes that haven't been detached. */
-	if (!of_node_check_flag(node, OF_DETACHED)) {
-		printk("WARNING: Bad of_node_put() on %s\n", node->full_name);
-		dump_stack();
-		kref_init(&node->kref);
-		return;
-	}
-
-	if (!of_node_check_flag(node, OF_DYNAMIC))
-		return;
-
-	while (prop) {
-		struct property *next = prop->next;
-		kfree(prop->name);
-		kfree(prop->value);
-		kfree(prop);
-		prop = next;
-
-		if (!prop) {
-			prop = node->deadprops;
-			node->deadprops = NULL;
-		}
-	}
-	kfree(node->full_name);
-	kfree(node->data);
-	kfree(node);
-}
-
-/**
- *	of_node_put - Decrement refcount of a node
- *	@node:	Node to dec refcount, NULL is supported to
- *		simplify writing of callers
- *
- */
-void of_node_put(struct device_node *node)
-{
-	if (node)
-		kref_put(&node->kref, of_node_release);
-}
-EXPORT_SYMBOL(of_node_put);
-
 /*
  * Plug a device node into the tree and global list.
  */
diff --git a/drivers/of/base.c b/drivers/of/base.c
index e81558f..4b10c89 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -60,6 +60,81 @@ int of_n_size_cells(struct device_node *np)
 }
 EXPORT_SYMBOL(of_n_size_cells);
 
+#if !defined(CONFIG_SPARC)   /* SPARC doesn't do ref counting (yet) */
+/**
+ *	of_node_get - Increment refcount of a node
+ *	@node:	Node to inc refcount, NULL is supported to
+ *		simplify writing of callers
+ *
+ *	Returns node.
+ */
+struct device_node *of_node_get(struct device_node *node)
+{
+	if (node)
+		kref_get(&node->kref);
+	return node;
+}
+EXPORT_SYMBOL(of_node_get);
+
+static inline struct device_node *kref_to_device_node(struct kref *kref)
+{
+	return container_of(kref, struct device_node, kref);
+}
+
+/**
+ *	of_node_release - release a dynamically allocated node
+ *	@kref:  kref element of the node to be released
+ *
+ *	In of_node_put() this function is passed to kref_put()
+ *	as the destructor.
+ */
+static void of_node_release(struct kref *kref)
+{
+	struct device_node *node = kref_to_device_node(kref);
+	struct property *prop = node->properties;
+
+	/* We should never be releasing nodes that haven't been detached. */
+	if (!of_node_check_flag(node, OF_DETACHED)) {
+		pr_err("ERROR: Bad of_node_put() on %s\n", node->full_name);
+		dump_stack();
+		kref_init(&node->kref);
+		return;
+	}
+
+	if (!of_node_check_flag(node, OF_DYNAMIC))
+		return;
+
+	while (prop) {
+		struct property *next = prop->next;
+		kfree(prop->name);
+		kfree(prop->value);
+		kfree(prop);
+		prop = next;
+
+		if (!prop) {
+			prop = node->deadprops;
+			node->deadprops = NULL;
+		}
+	}
+	kfree(node->full_name);
+	kfree(node->data);
+	kfree(node);
+}
+
+/**
+ *	of_node_put - Decrement refcount of a node
+ *	@node:	Node to dec refcount, NULL is supported to
+ *		simplify writing of callers
+ *
+ */
+void of_node_put(struct device_node *node)
+{
+	if (node)
+		kref_put(&node->kref, of_node_release);
+}
+EXPORT_SYMBOL(of_node_put);
+#endif /* !CONFIG_SPARC */
+
 struct property *of_find_property(const struct device_node *np,
 				  const char *name,
 				  int *lenp)

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

* [PATCH 09/11] of: merge of_attach_node() & of_detach_node()
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-24  8:19   ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/include/asm/prom.h |    4 --
 arch/microblaze/kernel/prom.c      |   59 -----------------------------------
 arch/powerpc/include/asm/prom.h    |    4 --
 arch/powerpc/kernel/prom.c         |   59 -----------------------------------
 drivers/of/base.c                  |   60 ++++++++++++++++++++++++++++++++++++
 include/linux/of.h                 |    4 ++
 6 files changed, 64 insertions(+), 126 deletions(-)

diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 07d1063..6c6b386 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -39,10 +39,6 @@ extern struct device_node *of_chosen;
 
 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);
 
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index c0d53b7..8c00457 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -313,65 +313,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 }
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
-/*
- * 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.
- */
-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;
 
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index 2ab9cbd..f384db8 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -34,10 +34,6 @@ extern struct device_node *of_chosen;
 
 #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
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 6873db9..7d0beeb 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -740,65 +740,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
 	return NULL;
 }
 
-/*
- * 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.
- */
-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:
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 4b10c89..9212b87 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -60,6 +60,66 @@ int of_n_size_cells(struct device_node *np)
 }
 EXPORT_SYMBOL(of_n_size_cells);
 
+/**
+ * of_attach_node - 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);
+}
+
+/**
+ * of_detach_node - "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_SPARC)   /* SPARC doesn't do ref counting (yet) */
 /**
  *	of_node_get - Increment refcount of a node
diff --git a/include/linux/of.h b/include/linux/of.h
index d4c014a..0a51742 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -130,6 +130,10 @@ static inline unsigned long of_read_ulong(const u32 *cell, int size)
 
 #define OF_BAD_ADDR	((u64)-1)
 
+/* For updating the device tree at runtime */
+extern void of_attach_node(struct device_node *);
+extern void of_detach_node(struct device_node *);
+
 extern struct device_node *of_find_node_by_name(struct device_node *from,
 	const char *name);
 #define for_each_node_by_name(dn, name) \


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

* [PATCH 09/11] of: merge of_attach_node() & of_detach_node()
@ 2009-11-24  8:19   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/include/asm/prom.h |    4 --
 arch/microblaze/kernel/prom.c      |   59 -----------------------------------
 arch/powerpc/include/asm/prom.h    |    4 --
 arch/powerpc/kernel/prom.c         |   59 -----------------------------------
 drivers/of/base.c                  |   60 ++++++++++++++++++++++++++++++++++++
 include/linux/of.h                 |    4 ++
 6 files changed, 64 insertions(+), 126 deletions(-)

diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 07d1063..6c6b386 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -39,10 +39,6 @@ extern struct device_node *of_chosen;
 
 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);
 
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index c0d53b7..8c00457 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -313,65 +313,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 }
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
-/*
- * 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.
- */
-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;
 
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index 2ab9cbd..f384db8 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -34,10 +34,6 @@ extern struct device_node *of_chosen;
 
 #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
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 6873db9..7d0beeb 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -740,65 +740,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
 	return NULL;
 }
 
-/*
- * 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.
- */
-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:
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 4b10c89..9212b87 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -60,6 +60,66 @@ int of_n_size_cells(struct device_node *np)
 }
 EXPORT_SYMBOL(of_n_size_cells);
 
+/**
+ * of_attach_node - 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);
+}
+
+/**
+ * of_detach_node - "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_SPARC)   /* SPARC doesn't do ref counting (yet) */
 /**
  *	of_node_get - Increment refcount of a node
diff --git a/include/linux/of.h b/include/linux/of.h
index d4c014a..0a51742 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -130,6 +130,10 @@ static inline unsigned long of_read_ulong(const u32 *cell, int size)
 
 #define OF_BAD_ADDR	((u64)-1)
 
+/* For updating the device tree at runtime */
+extern void of_attach_node(struct device_node *);
+extern void of_detach_node(struct device_node *);
+
 extern struct device_node *of_find_node_by_name(struct device_node *from,
 	const char *name);
 #define for_each_node_by_name(dn, name) \


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

* [PATCH 09/11] of: merge of_attach_node() & of_detach_node()
@ 2009-11-24  8:19   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/include/asm/prom.h |    4 --
 arch/microblaze/kernel/prom.c      |   59 -----------------------------------
 arch/powerpc/include/asm/prom.h    |    4 --
 arch/powerpc/kernel/prom.c         |   59 -----------------------------------
 drivers/of/base.c                  |   60 ++++++++++++++++++++++++++++++++++++
 include/linux/of.h                 |    4 ++
 6 files changed, 64 insertions(+), 126 deletions(-)

diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 07d1063..6c6b386 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -39,10 +39,6 @@ extern struct device_node *of_chosen;
 
 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);
 
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index c0d53b7..8c00457 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -313,65 +313,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 }
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
-/*
- * 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.
- */
-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;
 
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index 2ab9cbd..f384db8 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -34,10 +34,6 @@ extern struct device_node *of_chosen;
 
 #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
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 6873db9..7d0beeb 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -740,65 +740,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
 	return NULL;
 }
 
-/*
- * 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.
- */
-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:
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 4b10c89..9212b87 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -60,6 +60,66 @@ int of_n_size_cells(struct device_node *np)
 }
 EXPORT_SYMBOL(of_n_size_cells);
 
+/**
+ * of_attach_node - 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);
+}
+
+/**
+ * of_detach_node - "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_SPARC)   /* SPARC doesn't do ref counting (yet) */
 /**
  *	of_node_get - Increment refcount of a node
diff --git a/include/linux/of.h b/include/linux/of.h
index d4c014a..0a51742 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -130,6 +130,10 @@ static inline unsigned long of_read_ulong(const u32 *cell, int size)
 
 #define OF_BAD_ADDR	((u64)-1)
 
+/* For updating the device tree at runtime */
+extern void of_attach_node(struct device_node *);
+extern void of_detach_node(struct device_node *);
+
 extern struct device_node *of_find_node_by_name(struct device_node *from,
 	const char *name);
 #define for_each_node_by_name(dn, name) \

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

* [PATCH 10/11] microblaze: gut implementation of early_init_dt_scan_cpus()
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-24  8:19   ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Microblaze only has one CPU, it isn't SMP at all.  This function is
effectively just a no-op, so remove it.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   54 -----------------------------------------
 1 files changed, 0 insertions(+), 54 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 8c00457..1f79e4d 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -50,60 +50,6 @@ struct device_node *of_chosen;
 int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
 				   int depth, void *data)
 {
-	static int logical_cpuid;
-	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	const u32 *intserv;
-	int i, nthreads;
-	int found = 0;
-
-	/* We are scanning "cpu" nodes only */
-	if (type == NULL || strcmp(type, "cpu") != 0)
-		return 0;
-
-	/* Get physical cpuid */
-	intserv = of_get_flat_dt_prop(node, "reg", NULL);
-	nthreads = 1;
-
-	/*
-	 * Now see if any of these threads match our boot cpu.
-	 * NOTE: This must match the parsing done in smp_setup_cpu_maps.
-	 */
-	for (i = 0; i < nthreads; i++) {
-		/*
-		 * version 2 of the kexec param format adds the phys cpuid of
-		 * booted proc.
-		 */
-		if (initial_boot_params && initial_boot_params->version >= 2) {
-			if (intserv[i] ==
-					initial_boot_params->boot_cpuid_phys) {
-				found = 1;
-				break;
-			}
-		} else {
-			/*
-			 * Check if it's the boot-cpu, set it's hw index now,
-			 * unfortunately this format did not support booting
-			 * off secondary threads.
-			 */
-			if (of_get_flat_dt_prop(node,
-					"linux,boot-cpu", NULL) != NULL) {
-				found = 1;
-				break;
-			}
-		}
-
-#ifdef CONFIG_SMP
-		/* logical cpu id is always 0 on UP kernels */
-		logical_cpuid++;
-#endif
-	}
-
-	if (found) {
-		pr_debug("boot cpu: logical %d physical %d\n", logical_cpuid,
-			intserv[i]);
-		boot_cpuid = logical_cpuid;
-	}
-
 	return 0;
 }
 


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

* [PATCH 10/11] microblaze: gut implementation of
@ 2009-11-24  8:19   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

Microblaze only has one CPU, it isn't SMP at all.  This function is
effectively just a no-op, so remove it.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   54 -----------------------------------------
 1 files changed, 0 insertions(+), 54 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 8c00457..1f79e4d 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -50,60 +50,6 @@ struct device_node *of_chosen;
 int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
 				   int depth, void *data)
 {
-	static int logical_cpuid;
-	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	const u32 *intserv;
-	int i, nthreads;
-	int found = 0;
-
-	/* We are scanning "cpu" nodes only */
-	if (type = NULL || strcmp(type, "cpu") != 0)
-		return 0;
-
-	/* Get physical cpuid */
-	intserv = of_get_flat_dt_prop(node, "reg", NULL);
-	nthreads = 1;
-
-	/*
-	 * Now see if any of these threads match our boot cpu.
-	 * NOTE: This must match the parsing done in smp_setup_cpu_maps.
-	 */
-	for (i = 0; i < nthreads; i++) {
-		/*
-		 * version 2 of the kexec param format adds the phys cpuid of
-		 * booted proc.
-		 */
-		if (initial_boot_params && initial_boot_params->version >= 2) {
-			if (intserv[i] =
-					initial_boot_params->boot_cpuid_phys) {
-				found = 1;
-				break;
-			}
-		} else {
-			/*
-			 * Check if it's the boot-cpu, set it's hw index now,
-			 * unfortunately this format did not support booting
-			 * off secondary threads.
-			 */
-			if (of_get_flat_dt_prop(node,
-					"linux,boot-cpu", NULL) != NULL) {
-				found = 1;
-				break;
-			}
-		}
-
-#ifdef CONFIG_SMP
-		/* logical cpu id is always 0 on UP kernels */
-		logical_cpuid++;
-#endif
-	}
-
-	if (found) {
-		pr_debug("boot cpu: logical %d physical %d\n", logical_cpuid,
-			intserv[i]);
-		boot_cpuid = logical_cpuid;
-	}
-
 	return 0;
 }
 


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

* [PATCH 10/11] microblaze: gut implementation of early_init_dt_scan_cpus()
@ 2009-11-24  8:19   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:19 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

Microblaze only has one CPU, it isn't SMP at all.  This function is
effectively just a no-op, so remove it.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/microblaze/kernel/prom.c |   54 -----------------------------------------
 1 files changed, 0 insertions(+), 54 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 8c00457..1f79e4d 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -50,60 +50,6 @@ struct device_node *of_chosen;
 int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
 				   int depth, void *data)
 {
-	static int logical_cpuid;
-	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	const u32 *intserv;
-	int i, nthreads;
-	int found = 0;
-
-	/* We are scanning "cpu" nodes only */
-	if (type == NULL || strcmp(type, "cpu") != 0)
-		return 0;
-
-	/* Get physical cpuid */
-	intserv = of_get_flat_dt_prop(node, "reg", NULL);
-	nthreads = 1;
-
-	/*
-	 * Now see if any of these threads match our boot cpu.
-	 * NOTE: This must match the parsing done in smp_setup_cpu_maps.
-	 */
-	for (i = 0; i < nthreads; i++) {
-		/*
-		 * version 2 of the kexec param format adds the phys cpuid of
-		 * booted proc.
-		 */
-		if (initial_boot_params && initial_boot_params->version >= 2) {
-			if (intserv[i] ==
-					initial_boot_params->boot_cpuid_phys) {
-				found = 1;
-				break;
-			}
-		} else {
-			/*
-			 * Check if it's the boot-cpu, set it's hw index now,
-			 * unfortunately this format did not support booting
-			 * off secondary threads.
-			 */
-			if (of_get_flat_dt_prop(node,
-					"linux,boot-cpu", NULL) != NULL) {
-				found = 1;
-				break;
-			}
-		}
-
-#ifdef CONFIG_SMP
-		/* logical cpu id is always 0 on UP kernels */
-		logical_cpuid++;
-#endif
-	}
-
-	if (found) {
-		pr_debug("boot cpu: logical %d physical %d\n", logical_cpuid,
-			intserv[i]);
-		boot_cpuid = logical_cpuid;
-	}
-
 	return 0;
 }
 

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

* [PATCH 11/11] of: unify phandle name in struct device_node
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-24  8:20   ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:20 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

In struct device_node, the phandle is named 'linux_phandle' for PowerPC
and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
difference, it is just an artifact of the code diverging over a couple
of years.  This patch renames .node to .linux_phandle for SPARC.

Note: the .node also existed in PowerPC/MicroBlaze, but the only user
seems to be arch/powerpc/platforms/powermac/pfunc_core.c.  It doesn't
look like the assignment between .linux_phandle and .node is
significantly different enough to warrant the separate code paths
unless ibm,phandle properties actually appear in Apple device trees.

I think it is safe to eliminate the old .node property and use
linux_phandle everywhere.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/powermac/pfunc_core.c |    2 +-
 arch/sparc/kernel/devices.c                  |    2 +-
 arch/sparc/kernel/of_device_32.c             |    2 +-
 arch/sparc/kernel/of_device_64.c             |    2 +-
 arch/sparc/kernel/prom_common.c              |    8 ++++----
 arch/sparc/kernel/smp_64.c                   |    2 +-
 drivers/of/fdt.c                             |    3 +--
 drivers/sbus/char/openprom.c                 |   10 +++++-----
 drivers/video/aty/atyfb_base.c               |    2 +-
 include/linux/of.h                           |    3 ---
 10 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c
index 96d5ce5..2004b19 100644
--- a/arch/powerpc/platforms/powermac/pfunc_core.c
+++ b/arch/powerpc/platforms/powermac/pfunc_core.c
@@ -842,7 +842,7 @@ struct pmf_function *__pmf_find_function(struct device_node *target,
 	list_for_each_entry(func, &dev->functions, link) {
 		if (name && strcmp(name, func->name))
 			continue;
-		if (func->phandle && target->node != func->phandle)
+		if (func->phandle && target->linux_phandle != func->phandle)
 			continue;
 		if ((func->flags & flags) == 0)
 			continue;
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index b171ae8..2196e71 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -59,7 +59,7 @@ static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg,
 
 	cur_inst = 0;
 	for_each_node_by_type(dp, "cpu") {
-		int err = check_cpu_node(dp->node, &cur_inst,
+		int err = check_cpu_node(dp->linux_phandle, &cur_inst,
 					 compare, compare_arg,
 					 prom_node, mid);
 		if (!err) {
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 4c26eb5..27f4c2e 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -433,7 +433,7 @@ build_resources:
 	if (!parent)
 		dev_set_name(&op->dev, "root");
 	else
-		dev_set_name(&op->dev, "%08x", dp->node);
+		dev_set_name(&op->dev, "%08x", dp->linux_phandle);
 
 	if (of_device_register(op)) {
 		printk("%s: Could not register of device.\n",
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index 881947e..9a6245d 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -666,7 +666,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
 	if (!parent)
 		dev_set_name(&op->dev, "root");
 	else
-		dev_set_name(&op->dev, "%08x", dp->node);
+		dev_set_name(&op->dev, "%08x", dp->linux_phandle);
 
 	if (of_device_register(op)) {
 		printk("%s: Could not register of device.\n",
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index d80a65d..2a3e302 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -42,7 +42,7 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 	struct device_node *np;
 
 	for (np = allnodes; np; np = np->allnext)
-		if (np->node == handle)
+		if (np->linux_phandle == handle)
 			break;
 
 	return np;
@@ -89,7 +89,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
 			void *old_val = prop->value;
 			int ret;
 
-			ret = prom_setprop(dp->node, name, val, len);
+			ret = prom_setprop(dp->linux_phandle, name, val, len);
 
 			err = -EINVAL;
 			if (ret >= 0) {
@@ -236,7 +236,7 @@ static struct device_node * __init prom_create_node(phandle node,
 
 	dp->name = get_one_property(node, "name");
 	dp->type = get_one_property(node, "device_type");
-	dp->node = node;
+	dp->linux_phandle = node;
 
 	dp->properties = build_prop_list(node);
 
@@ -313,7 +313,7 @@ void __init prom_build_devicetree(void)
 
 	nextp = &allnodes->allnext;
 	allnodes->child = prom_build_tree(allnodes,
-					  prom_getchild(allnodes->node),
+					  prom_getchild(allnodes->linux_phandle),
 					  &nextp);
 	of_console_init();
 
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index aa36223..9222700 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -370,7 +370,7 @@ static int __cpuinit smp_boot_one_cpu(unsigned int cpu)
 	} else {
 		struct device_node *dp = of_find_node_by_cpuid(cpu);
 
-		prom_startcpu(dp->node, entry, cookie);
+		prom_startcpu(dp->linux_phandle, entry, cookie);
 	}
 
 	for (timeout = 0; timeout < 50000; timeout++) {
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 6164781..07ae161 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -315,9 +315,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
 					__alignof__(struct property));
 		if (allnextpp) {
 			if (strcmp(pname, "linux,phandle") == 0) {
-				np->node = *((u32 *)*p);
 				if (np->linux_phandle == 0)
-					np->linux_phandle = np->node;
+					np->linux_phandle = *((u32 *)*p);
 			}
 			if (strcmp(pname, "ibm,phandle") == 0)
 				np->linux_phandle = *((u32 *)*p);
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index 75ac19b..a776e65 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -233,7 +233,7 @@ static int opromnext(void __user *argp, unsigned int cmd, struct device_node *dp
 
 	ph = 0;
 	if (dp)
-		ph = dp->node;
+		ph = dp->linux_phandle;
 
 	data->current_node = dp;
 	*((int *) op->oprom_array) = ph;
@@ -256,7 +256,7 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp
 
 		dp = pci_device_to_OF_node(pdev);
 		data->current_node = dp;
-		*((int *)op->oprom_array) = dp->node;
+		*((int *)op->oprom_array) = dp->linux_phandle;
 		op->oprom_size = sizeof(int);
 		err = copyout(argp, op, bufsize + sizeof(int));
 
@@ -273,7 +273,7 @@ static int oprompath2node(void __user *argp, struct device_node *dp, struct open
 
 	dp = of_find_node_by_path(op->oprom_array);
 	if (dp)
-		ph = dp->node;
+		ph = dp->linux_phandle;
 	data->current_node = dp;
 	*((int *)op->oprom_array) = ph;
 	op->oprom_size = sizeof(int);
@@ -540,7 +540,7 @@ static int opiocgetnext(unsigned int cmd, void __user *argp)
 		}
 	}
 	if (dp)
-		nd = dp->node;
+		nd = dp->linux_phandle;
 	if (copy_to_user(argp, &nd, sizeof(phandle)))
 		return -EFAULT;
 
@@ -570,7 +570,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
 	case OPIOCGETOPTNODE:
 		BUILD_BUG_ON(sizeof(phandle) != sizeof(int));
 
-		if (copy_to_user(argp, &options_node->node, sizeof(phandle)))
+		if (copy_to_user(argp, &options_node->linux_phandle, sizeof(phandle)))
 			return -EFAULT;
 
 		return 0;
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 913b4a4..8357927 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -3104,7 +3104,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
 	}
 
 	dp = pci_device_to_OF_node(pdev);
-	if (node == dp->node) {
+	if (node == dp->linux_phandle) {
 		struct fb_var_screeninfo *var = &default_var;
 		unsigned int N, P, Q, M, T, R;
 		u32 v_total, h_total;
diff --git a/include/linux/of.h b/include/linux/of.h
index 0a51742..0ddd985 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -39,10 +39,7 @@ struct of_irq_controller;
 struct device_node {
 	const char *name;
 	const char *type;
-	phandle	node;
-#if !defined(CONFIG_SPARC)
 	phandle linux_phandle;
-#endif
 	char	*full_name;
 
 	struct	property *properties;


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

* [PATCH 11/11] of: unify phandle name in struct device_node
@ 2009-11-24  8:20   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:20 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, dave

In struct device_node, the phandle is named 'linux_phandle' for PowerPC
and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
difference, it is just an artifact of the code diverging over a couple
of years.  This patch renames .node to .linux_phandle for SPARC.

Note: the .node also existed in PowerPC/MicroBlaze, but the only user
seems to be arch/powerpc/platforms/powermac/pfunc_core.c.  It doesn't
look like the assignment between .linux_phandle and .node is
significantly different enough to warrant the separate code paths
unless ibm,phandle properties actually appear in Apple device trees.

I think it is safe to eliminate the old .node property and use
linux_phandle everywhere.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/powermac/pfunc_core.c |    2 +-
 arch/sparc/kernel/devices.c                  |    2 +-
 arch/sparc/kernel/of_device_32.c             |    2 +-
 arch/sparc/kernel/of_device_64.c             |    2 +-
 arch/sparc/kernel/prom_common.c              |    8 ++++----
 arch/sparc/kernel/smp_64.c                   |    2 +-
 drivers/of/fdt.c                             |    3 +--
 drivers/sbus/char/openprom.c                 |   10 +++++-----
 drivers/video/aty/atyfb_base.c               |    2 +-
 include/linux/of.h                           |    3 ---
 10 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c
index 96d5ce5..2004b19 100644
--- a/arch/powerpc/platforms/powermac/pfunc_core.c
+++ b/arch/powerpc/platforms/powermac/pfunc_core.c
@@ -842,7 +842,7 @@ struct pmf_function *__pmf_find_function(struct device_node *target,
 	list_for_each_entry(func, &dev->functions, link) {
 		if (name && strcmp(name, func->name))
 			continue;
-		if (func->phandle && target->node != func->phandle)
+		if (func->phandle && target->linux_phandle != func->phandle)
 			continue;
 		if ((func->flags & flags) = 0)
 			continue;
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index b171ae8..2196e71 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -59,7 +59,7 @@ static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg,
 
 	cur_inst = 0;
 	for_each_node_by_type(dp, "cpu") {
-		int err = check_cpu_node(dp->node, &cur_inst,
+		int err = check_cpu_node(dp->linux_phandle, &cur_inst,
 					 compare, compare_arg,
 					 prom_node, mid);
 		if (!err) {
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 4c26eb5..27f4c2e 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -433,7 +433,7 @@ build_resources:
 	if (!parent)
 		dev_set_name(&op->dev, "root");
 	else
-		dev_set_name(&op->dev, "%08x", dp->node);
+		dev_set_name(&op->dev, "%08x", dp->linux_phandle);
 
 	if (of_device_register(op)) {
 		printk("%s: Could not register of device.\n",
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index 881947e..9a6245d 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -666,7 +666,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
 	if (!parent)
 		dev_set_name(&op->dev, "root");
 	else
-		dev_set_name(&op->dev, "%08x", dp->node);
+		dev_set_name(&op->dev, "%08x", dp->linux_phandle);
 
 	if (of_device_register(op)) {
 		printk("%s: Could not register of device.\n",
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index d80a65d..2a3e302 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -42,7 +42,7 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 	struct device_node *np;
 
 	for (np = allnodes; np; np = np->allnext)
-		if (np->node = handle)
+		if (np->linux_phandle = handle)
 			break;
 
 	return np;
@@ -89,7 +89,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
 			void *old_val = prop->value;
 			int ret;
 
-			ret = prom_setprop(dp->node, name, val, len);
+			ret = prom_setprop(dp->linux_phandle, name, val, len);
 
 			err = -EINVAL;
 			if (ret >= 0) {
@@ -236,7 +236,7 @@ static struct device_node * __init prom_create_node(phandle node,
 
 	dp->name = get_one_property(node, "name");
 	dp->type = get_one_property(node, "device_type");
-	dp->node = node;
+	dp->linux_phandle = node;
 
 	dp->properties = build_prop_list(node);
 
@@ -313,7 +313,7 @@ void __init prom_build_devicetree(void)
 
 	nextp = &allnodes->allnext;
 	allnodes->child = prom_build_tree(allnodes,
-					  prom_getchild(allnodes->node),
+					  prom_getchild(allnodes->linux_phandle),
 					  &nextp);
 	of_console_init();
 
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index aa36223..9222700 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -370,7 +370,7 @@ static int __cpuinit smp_boot_one_cpu(unsigned int cpu)
 	} else {
 		struct device_node *dp = of_find_node_by_cpuid(cpu);
 
-		prom_startcpu(dp->node, entry, cookie);
+		prom_startcpu(dp->linux_phandle, entry, cookie);
 	}
 
 	for (timeout = 0; timeout < 50000; timeout++) {
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 6164781..07ae161 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -315,9 +315,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
 					__alignof__(struct property));
 		if (allnextpp) {
 			if (strcmp(pname, "linux,phandle") = 0) {
-				np->node = *((u32 *)*p);
 				if (np->linux_phandle = 0)
-					np->linux_phandle = np->node;
+					np->linux_phandle = *((u32 *)*p);
 			}
 			if (strcmp(pname, "ibm,phandle") = 0)
 				np->linux_phandle = *((u32 *)*p);
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index 75ac19b..a776e65 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -233,7 +233,7 @@ static int opromnext(void __user *argp, unsigned int cmd, struct device_node *dp
 
 	ph = 0;
 	if (dp)
-		ph = dp->node;
+		ph = dp->linux_phandle;
 
 	data->current_node = dp;
 	*((int *) op->oprom_array) = ph;
@@ -256,7 +256,7 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp
 
 		dp = pci_device_to_OF_node(pdev);
 		data->current_node = dp;
-		*((int *)op->oprom_array) = dp->node;
+		*((int *)op->oprom_array) = dp->linux_phandle;
 		op->oprom_size = sizeof(int);
 		err = copyout(argp, op, bufsize + sizeof(int));
 
@@ -273,7 +273,7 @@ static int oprompath2node(void __user *argp, struct device_node *dp, struct open
 
 	dp = of_find_node_by_path(op->oprom_array);
 	if (dp)
-		ph = dp->node;
+		ph = dp->linux_phandle;
 	data->current_node = dp;
 	*((int *)op->oprom_array) = ph;
 	op->oprom_size = sizeof(int);
@@ -540,7 +540,7 @@ static int opiocgetnext(unsigned int cmd, void __user *argp)
 		}
 	}
 	if (dp)
-		nd = dp->node;
+		nd = dp->linux_phandle;
 	if (copy_to_user(argp, &nd, sizeof(phandle)))
 		return -EFAULT;
 
@@ -570,7 +570,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
 	case OPIOCGETOPTNODE:
 		BUILD_BUG_ON(sizeof(phandle) != sizeof(int));
 
-		if (copy_to_user(argp, &options_node->node, sizeof(phandle)))
+		if (copy_to_user(argp, &options_node->linux_phandle, sizeof(phandle)))
 			return -EFAULT;
 
 		return 0;
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 913b4a4..8357927 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -3104,7 +3104,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
 	}
 
 	dp = pci_device_to_OF_node(pdev);
-	if (node = dp->node) {
+	if (node = dp->linux_phandle) {
 		struct fb_var_screeninfo *var = &default_var;
 		unsigned int N, P, Q, M, T, R;
 		u32 v_total, h_total;
diff --git a/include/linux/of.h b/include/linux/of.h
index 0a51742..0ddd985 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -39,10 +39,7 @@ struct of_irq_controller;
 struct device_node {
 	const char *name;
 	const char *type;
-	phandle	node;
-#if !defined(CONFIG_SPARC)
 	phandle linux_phandle;
-#endif
 	char	*full_name;
 
 	struct	property *properties;


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

* [PATCH 11/11] of: unify phandle name in struct device_node
@ 2009-11-24  8:20   ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24  8:20 UTC (permalink / raw)
  To: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

In struct device_node, the phandle is named 'linux_phandle' for PowerPC
and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
difference, it is just an artifact of the code diverging over a couple
of years.  This patch renames .node to .linux_phandle for SPARC.

Note: the .node also existed in PowerPC/MicroBlaze, but the only user
seems to be arch/powerpc/platforms/powermac/pfunc_core.c.  It doesn't
look like the assignment between .linux_phandle and .node is
significantly different enough to warrant the separate code paths
unless ibm,phandle properties actually appear in Apple device trees.

I think it is safe to eliminate the old .node property and use
linux_phandle everywhere.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/powermac/pfunc_core.c |    2 +-
 arch/sparc/kernel/devices.c                  |    2 +-
 arch/sparc/kernel/of_device_32.c             |    2 +-
 arch/sparc/kernel/of_device_64.c             |    2 +-
 arch/sparc/kernel/prom_common.c              |    8 ++++----
 arch/sparc/kernel/smp_64.c                   |    2 +-
 drivers/of/fdt.c                             |    3 +--
 drivers/sbus/char/openprom.c                 |   10 +++++-----
 drivers/video/aty/atyfb_base.c               |    2 +-
 include/linux/of.h                           |    3 ---
 10 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c
index 96d5ce5..2004b19 100644
--- a/arch/powerpc/platforms/powermac/pfunc_core.c
+++ b/arch/powerpc/platforms/powermac/pfunc_core.c
@@ -842,7 +842,7 @@ struct pmf_function *__pmf_find_function(struct device_node *target,
 	list_for_each_entry(func, &dev->functions, link) {
 		if (name && strcmp(name, func->name))
 			continue;
-		if (func->phandle && target->node != func->phandle)
+		if (func->phandle && target->linux_phandle != func->phandle)
 			continue;
 		if ((func->flags & flags) == 0)
 			continue;
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index b171ae8..2196e71 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -59,7 +59,7 @@ static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg,
 
 	cur_inst = 0;
 	for_each_node_by_type(dp, "cpu") {
-		int err = check_cpu_node(dp->node, &cur_inst,
+		int err = check_cpu_node(dp->linux_phandle, &cur_inst,
 					 compare, compare_arg,
 					 prom_node, mid);
 		if (!err) {
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 4c26eb5..27f4c2e 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -433,7 +433,7 @@ build_resources:
 	if (!parent)
 		dev_set_name(&op->dev, "root");
 	else
-		dev_set_name(&op->dev, "%08x", dp->node);
+		dev_set_name(&op->dev, "%08x", dp->linux_phandle);
 
 	if (of_device_register(op)) {
 		printk("%s: Could not register of device.\n",
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index 881947e..9a6245d 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -666,7 +666,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
 	if (!parent)
 		dev_set_name(&op->dev, "root");
 	else
-		dev_set_name(&op->dev, "%08x", dp->node);
+		dev_set_name(&op->dev, "%08x", dp->linux_phandle);
 
 	if (of_device_register(op)) {
 		printk("%s: Could not register of device.\n",
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index d80a65d..2a3e302 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -42,7 +42,7 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 	struct device_node *np;
 
 	for (np = allnodes; np; np = np->allnext)
-		if (np->node == handle)
+		if (np->linux_phandle == handle)
 			break;
 
 	return np;
@@ -89,7 +89,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
 			void *old_val = prop->value;
 			int ret;
 
-			ret = prom_setprop(dp->node, name, val, len);
+			ret = prom_setprop(dp->linux_phandle, name, val, len);
 
 			err = -EINVAL;
 			if (ret >= 0) {
@@ -236,7 +236,7 @@ static struct device_node * __init prom_create_node(phandle node,
 
 	dp->name = get_one_property(node, "name");
 	dp->type = get_one_property(node, "device_type");
-	dp->node = node;
+	dp->linux_phandle = node;
 
 	dp->properties = build_prop_list(node);
 
@@ -313,7 +313,7 @@ void __init prom_build_devicetree(void)
 
 	nextp = &allnodes->allnext;
 	allnodes->child = prom_build_tree(allnodes,
-					  prom_getchild(allnodes->node),
+					  prom_getchild(allnodes->linux_phandle),
 					  &nextp);
 	of_console_init();
 
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index aa36223..9222700 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -370,7 +370,7 @@ static int __cpuinit smp_boot_one_cpu(unsigned int cpu)
 	} else {
 		struct device_node *dp = of_find_node_by_cpuid(cpu);
 
-		prom_startcpu(dp->node, entry, cookie);
+		prom_startcpu(dp->linux_phandle, entry, cookie);
 	}
 
 	for (timeout = 0; timeout < 50000; timeout++) {
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 6164781..07ae161 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -315,9 +315,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
 					__alignof__(struct property));
 		if (allnextpp) {
 			if (strcmp(pname, "linux,phandle") == 0) {
-				np->node = *((u32 *)*p);
 				if (np->linux_phandle == 0)
-					np->linux_phandle = np->node;
+					np->linux_phandle = *((u32 *)*p);
 			}
 			if (strcmp(pname, "ibm,phandle") == 0)
 				np->linux_phandle = *((u32 *)*p);
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index 75ac19b..a776e65 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -233,7 +233,7 @@ static int opromnext(void __user *argp, unsigned int cmd, struct device_node *dp
 
 	ph = 0;
 	if (dp)
-		ph = dp->node;
+		ph = dp->linux_phandle;
 
 	data->current_node = dp;
 	*((int *) op->oprom_array) = ph;
@@ -256,7 +256,7 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp
 
 		dp = pci_device_to_OF_node(pdev);
 		data->current_node = dp;
-		*((int *)op->oprom_array) = dp->node;
+		*((int *)op->oprom_array) = dp->linux_phandle;
 		op->oprom_size = sizeof(int);
 		err = copyout(argp, op, bufsize + sizeof(int));
 
@@ -273,7 +273,7 @@ static int oprompath2node(void __user *argp, struct device_node *dp, struct open
 
 	dp = of_find_node_by_path(op->oprom_array);
 	if (dp)
-		ph = dp->node;
+		ph = dp->linux_phandle;
 	data->current_node = dp;
 	*((int *)op->oprom_array) = ph;
 	op->oprom_size = sizeof(int);
@@ -540,7 +540,7 @@ static int opiocgetnext(unsigned int cmd, void __user *argp)
 		}
 	}
 	if (dp)
-		nd = dp->node;
+		nd = dp->linux_phandle;
 	if (copy_to_user(argp, &nd, sizeof(phandle)))
 		return -EFAULT;
 
@@ -570,7 +570,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
 	case OPIOCGETOPTNODE:
 		BUILD_BUG_ON(sizeof(phandle) != sizeof(int));
 
-		if (copy_to_user(argp, &options_node->node, sizeof(phandle)))
+		if (copy_to_user(argp, &options_node->linux_phandle, sizeof(phandle)))
 			return -EFAULT;
 
 		return 0;
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 913b4a4..8357927 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -3104,7 +3104,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
 	}
 
 	dp = pci_device_to_OF_node(pdev);
-	if (node == dp->node) {
+	if (node == dp->linux_phandle) {
 		struct fb_var_screeninfo *var = &default_var;
 		unsigned int N, P, Q, M, T, R;
 		u32 v_total, h_total;
diff --git a/include/linux/of.h b/include/linux/of.h
index 0a51742..0ddd985 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -39,10 +39,7 @@ struct of_irq_controller;
 struct device_node {
 	const char *name;
 	const char *type;
-	phandle	node;
-#if !defined(CONFIG_SPARC)
 	phandle linux_phandle;
-#endif
 	char	*full_name;
 
 	struct	property *properties;

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
  2009-11-24  8:20   ` Grant Likely
  (?)
@ 2009-11-24 17:37     ` David Miller
  -1 siblings, 0 replies; 123+ messages in thread
From: David Miller @ 2009-11-24 17:37 UTC (permalink / raw)
  To: grant.likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, monstr

From: Grant Likely <grant.likely@secretlab.ca>
Date: Tue, 24 Nov 2009 01:20:05 -0700

> In struct device_node, the phandle is named 'linux_phandle' for PowerPC
> and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
> difference, it is just an artifact of the code diverging over a couple
> of years.  This patch renames .node to .linux_phandle for SPARC.

I know it's just a name, but there is no reason to put "linux" in the
member name.  It's the real device phandle value from OpenFirmware not
something invented by Linux's OF layer.

PowerPC uses this for something different, it records the information
here using the special "linux,phandle" and "ibm,phandle" properties.

See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
changes.

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
@ 2009-11-24 17:37     ` David Miller
  0 siblings, 0 replies; 123+ messages in thread
From: David Miller @ 2009-11-24 17:37 UTC (permalink / raw)
  To: grant.likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, monstr

From: Grant Likely <grant.likely@secretlab.ca>
Date: Tue, 24 Nov 2009 01:20:05 -0700

> In struct device_node, the phandle is named 'linux_phandle' for PowerPC
> and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
> difference, it is just an artifact of the code diverging over a couple
> of years.  This patch renames .node to .linux_phandle for SPARC.

I know it's just a name, but there is no reason to put "linux" in the
member name.  It's the real device phandle value from OpenFirmware not
something invented by Linux's OF layer.

PowerPC uses this for something different, it records the information
here using the special "linux,phandle" and "ibm,phandle" properties.

See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
changes.

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
@ 2009-11-24 17:37     ` David Miller
  0 siblings, 0 replies; 123+ messages in thread
From: David Miller @ 2009-11-24 17:37 UTC (permalink / raw)
  To: grant.likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev

From: Grant Likely <grant.likely@secretlab.ca>
Date: Tue, 24 Nov 2009 01:20:05 -0700

> In struct device_node, the phandle is named 'linux_phandle' for PowerPC
> and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
> difference, it is just an artifact of the code diverging over a couple
> of years.  This patch renames .node to .linux_phandle for SPARC.

I know it's just a name, but there is no reason to put "linux" in the
member name.  It's the real device phandle value from OpenFirmware not
something invented by Linux's OF layer.

PowerPC uses this for something different, it records the information
here using the special "linux,phandle" and "ibm,phandle" properties.

See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
changes.

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
  2009-11-24 17:37     ` David Miller
  (?)
@ 2009-11-24 20:33       ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24 20:33 UTC (permalink / raw)
  To: David Miller
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, monstr

On Tue, Nov 24, 2009 at 10:37 AM, David Miller <davem@davemloft.net> wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> Date: Tue, 24 Nov 2009 01:20:05 -0700
>
>> In struct device_node, the phandle is named 'linux_phandle' for PowerPC
>> and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
>> difference, it is just an artifact of the code diverging over a couple
>> of years.  This patch renames .node to .linux_phandle for SPARC.
>
> I know it's just a name, but there is no reason to put "linux" in the
> member name.  It's the real device phandle value from OpenFirmware not
> something invented by Linux's OF layer.

I agree, and I also considered renaming it to simply 'phandle' or to
change the powerpc code back to using .node everywhere (more on .node
usage in powerpc below).  I didn't want to use .node because .node is
pretty generic, and is used in other places for different things.
Basically I wanted to avoid confusion.  In particular, .node points to
a device_node, not a phandle, in struct of_device.  Changing all
references to simply 'phandle' seems to be the best, but it does
require changes to more locations in the code.  In the end I decided
on some constructive lazyness by settling for the already-used
.linux_phandle so that I would need to touch as many files, but still
retain a unique name that is easy to find.  If you prefer, I can
change it all to simply '.phandle'.

> PowerPC uses this for something different, it records the information
> here using the special "linux,phandle" and "ibm,phandle" properties.

Agreed, the phandle isn't a real phandle when using the flat tree.
However, though the source of the phandle value is different, the use
case is identical, so it make sense to stuff it into the same member.
Merging them lets me unify more code.  For example,
of_find_node_by_phandle().

> See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
> changes.

Yup, I looked at this.  The unflatten code stuffs both linux,phandle
and ibm,phandle into .linux_phandle, and linux,phandle also gets
stuffed into .node.  But all the users except one use the
.linux_phandle, not .node, and that remaining user *I think* can
safely use .linux_phandle too.

Thanks for the review,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
@ 2009-11-24 20:33       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24 20:33 UTC (permalink / raw)
  To: David Miller
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, monstr

On Tue, Nov 24, 2009 at 10:37 AM, David Miller <davem@davemloft.net> wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> Date: Tue, 24 Nov 2009 01:20:05 -0700
>
>> In struct device_node, the phandle is named 'linux_phandle' for PowerPC
>> and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
>> difference, it is just an artifact of the code diverging over a couple
>> of years.  This patch renames .node to .linux_phandle for SPARC.
>
> I know it's just a name, but there is no reason to put "linux" in the
> member name.  It's the real device phandle value from OpenFirmware not
> something invented by Linux's OF layer.

I agree, and I also considered renaming it to simply 'phandle' or to
change the powerpc code back to using .node everywhere (more on .node
usage in powerpc below).  I didn't want to use .node because .node is
pretty generic, and is used in other places for different things.
Basically I wanted to avoid confusion.  In particular, .node points to
a device_node, not a phandle, in struct of_device.  Changing all
references to simply 'phandle' seems to be the best, but it does
require changes to more locations in the code.  In the end I decided
on some constructive lazyness by settling for the already-used
.linux_phandle so that I would need to touch as many files, but still
retain a unique name that is easy to find.  If you prefer, I can
change it all to simply '.phandle'.

> PowerPC uses this for something different, it records the information
> here using the special "linux,phandle" and "ibm,phandle" properties.

Agreed, the phandle isn't a real phandle when using the flat tree.
However, though the source of the phandle value is different, the use
case is identical, so it make sense to stuff it into the same member.
Merging them lets me unify more code.  For example,
of_find_node_by_phandle().

> See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
> changes.

Yup, I looked at this.  The unflatten code stuffs both linux,phandle
and ibm,phandle into .linux_phandle, and linux,phandle also gets
stuffed into .node.  But all the users except one use the
.linux_phandle, not .node, and that remaining user *I think* can
safely use .linux_phandle too.

Thanks for the review,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
@ 2009-11-24 20:33       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24 20:33 UTC (permalink / raw)
  To: David Miller
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev

On Tue, Nov 24, 2009 at 10:37 AM, David Miller <davem@davemloft.net> wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> Date: Tue, 24 Nov 2009 01:20:05 -0700
>
>> In struct device_node, the phandle is named 'linux_phandle' for PowerPC
>> and MicroBlaze, and 'node' for SPARC. =A0There is no good reason for the
>> difference, it is just an artifact of the code diverging over a couple
>> of years. =A0This patch renames .node to .linux_phandle for SPARC.
>
> I know it's just a name, but there is no reason to put "linux" in the
> member name. =A0It's the real device phandle value from OpenFirmware not
> something invented by Linux's OF layer.

I agree, and I also considered renaming it to simply 'phandle' or to
change the powerpc code back to using .node everywhere (more on .node
usage in powerpc below).  I didn't want to use .node because .node is
pretty generic, and is used in other places for different things.
Basically I wanted to avoid confusion.  In particular, .node points to
a device_node, not a phandle, in struct of_device.  Changing all
references to simply 'phandle' seems to be the best, but it does
require changes to more locations in the code.  In the end I decided
on some constructive lazyness by settling for the already-used
.linux_phandle so that I would need to touch as many files, but still
retain a unique name that is easy to find.  If you prefer, I can
change it all to simply '.phandle'.

> PowerPC uses this for something different, it records the information
> here using the special "linux,phandle" and "ibm,phandle" properties.

Agreed, the phandle isn't a real phandle when using the flat tree.
However, though the source of the phandle value is different, the use
case is identical, so it make sense to stuff it into the same member.
Merging them lets me unify more code.  For example,
of_find_node_by_phandle().

> See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
> changes.

Yup, I looked at this.  The unflatten code stuffs both linux,phandle
and ibm,phandle into .linux_phandle, and linux,phandle also gets
stuffed into .node.  But all the users except one use the
.linux_phandle, not .node, and that remaining user *I think* can
safely use .linux_phandle too.

Thanks for the review,
g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
       [not found]     ` <20091124.093732.203692950.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
  2009-11-24 21:06         ` Benjamin Herrenschmidt
@ 2009-11-24 21:06         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-24 21:06 UTC (permalink / raw)
  To: David Miller
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ

On Tue, 2009-11-24 at 09:37 -0800, David Miller wrote:
> From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Date: Tue, 24 Nov 2009 01:20:05 -0700
> 
> > In struct device_node, the phandle is named 'linux_phandle' for PowerPC
> > and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
> > difference, it is just an artifact of the code diverging over a couple
> > of years.  This patch renames .node to .linux_phandle for SPARC.
> 
> I know it's just a name, but there is no reason to put "linux" in the
> member name.  It's the real device phandle value from OpenFirmware not
> something invented by Linux's OF layer.
> 
> PowerPC uses this for something different, it records the information
> here using the special "linux,phandle" and "ibm,phandle" properties.
> 
> See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
> changes.

Right, this comes from a subtle problem with our firmwares on pSeries.

We have a phandle from OF. But some devices, especially virtual devices,
also have an "ibm,phandle" which may or may not be the same afaik.

In addition, when the hypervisor hotplugs some devices, it sends us some
new device-tree bits to add. Those don't have a phandle in the formal
sense afaik, but -do- have an ibm,phandle property.

I think we can always just use ibm,phandle instead of the OF one when
the former is present, they should be non overlapping, but of course,
any chance in that area will require plenty of testing on some of those
machines.

Cheers,
Ben.

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
@ 2009-11-24 21:06         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-24 21:06 UTC (permalink / raw)
  To: David Miller
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ

On Tue, 2009-11-24 at 09:37 -0800, David Miller wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> Date: Tue, 24 Nov 2009 01:20:05 -0700
> 
> > In struct device_node, the phandle is named 'linux_phandle' for PowerPC
> > and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
> > difference, it is just an artifact of the code diverging over a couple
> > of years.  This patch renames .node to .linux_phandle for SPARC.
> 
> I know it's just a name, but there is no reason to put "linux" in the
> member name.  It's the real device phandle value from OpenFirmware not
> something invented by Linux's OF layer.
> 
> PowerPC uses this for something different, it records the information
> here using the special "linux,phandle" and "ibm,phandle" properties.
> 
> See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
> changes.

Right, this comes from a subtle problem with our firmwares on pSeries.

We have a phandle from OF. But some devices, especially virtual devices,
also have an "ibm,phandle" which may or may not be the same afaik.

In addition, when the hypervisor hotplugs some devices, it sends us some
new device-tree bits to add. Those don't have a phandle in the formal
sense afaik, but -do- have an ibm,phandle property.

I think we can always just use ibm,phandle instead of the OF one when
the former is present, they should be non overlapping, but of course,
any chance in that area will require plenty of testing on some of those
machines.

Cheers,
Ben.


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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
@ 2009-11-24 21:06         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-24 21:06 UTC (permalink / raw)
  To: David Miller
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev

On Tue, 2009-11-24 at 09:37 -0800, David Miller wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> Date: Tue, 24 Nov 2009 01:20:05 -0700
> 
> > In struct device_node, the phandle is named 'linux_phandle' for PowerPC
> > and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
> > difference, it is just an artifact of the code diverging over a couple
> > of years.  This patch renames .node to .linux_phandle for SPARC.
> 
> I know it's just a name, but there is no reason to put "linux" in the
> member name.  It's the real device phandle value from OpenFirmware not
> something invented by Linux's OF layer.
> 
> PowerPC uses this for something different, it records the information
> here using the special "linux,phandle" and "ibm,phandle" properties.
> 
> See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
> changes.

Right, this comes from a subtle problem with our firmwares on pSeries.

We have a phandle from OF. But some devices, especially virtual devices,
also have an "ibm,phandle" which may or may not be the same afaik.

In addition, when the hypervisor hotplugs some devices, it sends us some
new device-tree bits to add. Those don't have a phandle in the formal
sense afaik, but -do- have an ibm,phandle property.

I think we can always just use ibm,phandle instead of the OF one when
the former is present, they should be non overlapping, but of course,
any chance in that area will require plenty of testing on some of those
machines.

Cheers,
Ben.

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
  2009-11-24 20:33       ` Grant Likely
@ 2009-11-24 21:10         ` David Miller
  -1 siblings, 0 replies; 123+ messages in thread
From: David Miller @ 2009-11-24 21:10 UTC (permalink / raw)
  To: grant.likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev

From: Grant Likely <grant.likely@secretlab.ca>
Date: Tue, 24 Nov 2009 13:33:22 -0700

> If you prefer, I can change it all to simply '.phandle'.

Please do.

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
@ 2009-11-24 21:10         ` David Miller
  0 siblings, 0 replies; 123+ messages in thread
From: David Miller @ 2009-11-24 21:10 UTC (permalink / raw)
  To: grant.likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev

From: Grant Likely <grant.likely@secretlab.ca>
Date: Tue, 24 Nov 2009 13:33:22 -0700

> If you prefer, I can change it all to simply '.phandle'.

Please do.

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
  2009-11-24 21:06         ` Benjamin Herrenschmidt
  (?)
@ 2009-11-24 21:39           ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24 21:39 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: David Miller, linuxppc-dev, devicetree-discuss, sparclinux,
	microblaze-uclinux, sfr, monstr

On Tue, Nov 24, 2009 at 2:06 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 09:37 -0800, David Miller wrote:
>> From: Grant Likely <grant.likely@secretlab.ca>
>> Date: Tue, 24 Nov 2009 01:20:05 -0700
>>
>> > In struct device_node, the phandle is named 'linux_phandle' for PowerPC
>> > and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
>> > difference, it is just an artifact of the code diverging over a couple
>> > of years.  This patch renames .node to .linux_phandle for SPARC.
>>
>> I know it's just a name, but there is no reason to put "linux" in the
>> member name.  It's the real device phandle value from OpenFirmware not
>> something invented by Linux's OF layer.
>>
>> PowerPC uses this for something different, it records the information
>> here using the special "linux,phandle" and "ibm,phandle" properties.
>>
>> See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
>> changes.
>
> Right, this comes from a subtle problem with our firmwares on pSeries.
>
> We have a phandle from OF. But some devices, especially virtual devices,
> also have an "ibm,phandle" which may or may not be the same afaik.
>
> In addition, when the hypervisor hotplugs some devices, it sends us some
> new device-tree bits to add. Those don't have a phandle in the formal
> sense afaik, but -do- have an ibm,phandle property.
>
> I think we can always just use ibm,phandle instead of the OF one when
> the former is present, they should be non overlapping, but of course,
> any chance in that area will require plenty of testing on some of those
> machines.

If pseries is the troublesome platform, not powermac, then I'm pretty
confident this change is okay.  I cannot find any other users of .node
other than arch/powerpc/platforms/powermac/pfunc_core.c, but I'll
double check with an allmodconfig and an allyesconfig.  This patch
shouldn't change the behaviour of linux_phandle at all.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
@ 2009-11-24 21:39           ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24 21:39 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: David Miller, linuxppc-dev, devicetree-discuss, sparclinux,
	microblaze-uclinux, sfr, monstr

On Tue, Nov 24, 2009 at 2:06 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 09:37 -0800, David Miller wrote:
>> From: Grant Likely <grant.likely@secretlab.ca>
>> Date: Tue, 24 Nov 2009 01:20:05 -0700
>>
>> > In struct device_node, the phandle is named 'linux_phandle' for PowerPC
>> > and MicroBlaze, and 'node' for SPARC.  There is no good reason for the
>> > difference, it is just an artifact of the code diverging over a couple
>> > of years.  This patch renames .node to .linux_phandle for SPARC.
>>
>> I know it's just a name, but there is no reason to put "linux" in the
>> member name.  It's the real device phandle value from OpenFirmware not
>> something invented by Linux's OF layer.
>>
>> PowerPC uses this for something different, it records the information
>> here using the special "linux,phandle" and "ibm,phandle" properties.
>>
>> See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
>> changes.
>
> Right, this comes from a subtle problem with our firmwares on pSeries.
>
> We have a phandle from OF. But some devices, especially virtual devices,
> also have an "ibm,phandle" which may or may not be the same afaik.
>
> In addition, when the hypervisor hotplugs some devices, it sends us some
> new device-tree bits to add. Those don't have a phandle in the formal
> sense afaik, but -do- have an ibm,phandle property.
>
> I think we can always just use ibm,phandle instead of the OF one when
> the former is present, they should be non overlapping, but of course,
> any chance in that area will require plenty of testing on some of those
> machines.

If pseries is the troublesome platform, not powermac, then I'm pretty
confident this change is okay.  I cannot find any other users of .node
other than arch/powerpc/platforms/powermac/pfunc_core.c, but I'll
double check with an allmodconfig and an allyesconfig.  This patch
shouldn't change the behaviour of linux_phandle at all.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 11/11] of: unify phandle name in struct device_node
@ 2009-11-24 21:39           ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-24 21:39 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, David Miller

On Tue, Nov 24, 2009 at 2:06 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 09:37 -0800, David Miller wrote:
>> From: Grant Likely <grant.likely@secretlab.ca>
>> Date: Tue, 24 Nov 2009 01:20:05 -0700
>>
>> > In struct device_node, the phandle is named 'linux_phandle' for PowerP=
C
>> > and MicroBlaze, and 'node' for SPARC. =A0There is no good reason for t=
he
>> > difference, it is just an artifact of the code diverging over a couple
>> > of years. =A0This patch renames .node to .linux_phandle for SPARC.
>>
>> I know it's just a name, but there is no reason to put "linux" in the
>> member name. =A0It's the real device phandle value from OpenFirmware not
>> something invented by Linux's OF layer.
>>
>> PowerPC uses this for something different, it records the information
>> here using the special "linux,phandle" and "ibm,phandle" properties.
>>
>> See unflatten_dt_node() in arch/powerpc/kernel/prom.c before your
>> changes.
>
> Right, this comes from a subtle problem with our firmwares on pSeries.
>
> We have a phandle from OF. But some devices, especially virtual devices,
> also have an "ibm,phandle" which may or may not be the same afaik.
>
> In addition, when the hypervisor hotplugs some devices, it sends us some
> new device-tree bits to add. Those don't have a phandle in the formal
> sense afaik, but -do- have an ibm,phandle property.
>
> I think we can always just use ibm,phandle instead of the OF one when
> the former is present, they should be non overlapping, but of course,
> any chance in that area will require plenty of testing on some of those
> machines.

If pseries is the troublesome platform, not powermac, then I'm pretty
confident this change is okay.  I cannot find any other users of .node
other than arch/powerpc/platforms/powermac/pfunc_core.c, but I'll
double check with an allmodconfig and an allyesconfig.  This patch
shouldn't change the behaviour of linux_phandle at all.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 01/11] of/flattree: Merge early_init_dt_check_for_initrd()
  2009-11-24  8:17   ` Grant Likely
@ 2009-11-26  3:51     ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  3:51 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Tue, 2009-11-24 at 01:17 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
> Tested-by: Michal Simek <monstr@monstr.eu>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Remind me how you want to merge that ? via my tree ?

Cheers,
Ben.

> ---
> 
>  arch/microblaze/kernel/prom.c |   32 --------------------------------
>  arch/powerpc/kernel/prom.c    |   30 ------------------------------
>  drivers/of/fdt.c              |   37 +++++++++++++++++++++++++++++++++++++
>  include/linux/of_fdt.h        |    1 +
>  4 files changed, 38 insertions(+), 62 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index a38e373..7959495 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -113,38 +113,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
>  	return 0;
>  }
>  
> -#ifdef CONFIG_BLK_DEV_INITRD
> -static void __init early_init_dt_check_for_initrd(unsigned long node)
> -{
> -	unsigned long l;
> -	u32 *prop;
> -
> -	pr_debug("Looking for initrd properties... ");
> -
> -	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
> -	if (prop) {
> -		initrd_start = (unsigned long)
> -					__va((u32)of_read_ulong(prop, l/4));
> -
> -		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
> -		if (prop) {
> -			initrd_end = (unsigned long)
> -					__va((u32)of_read_ulong(prop, 1/4));
> -			initrd_below_start_ok = 1;
> -		} else {
> -			initrd_start = 0;
> -		}
> -	}
> -
> -	pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
> -					initrd_start, initrd_end);
> -}
> -#else
> -static inline void early_init_dt_check_for_initrd(unsigned long node)
> -{
> -}
> -#endif /* CONFIG_BLK_DEV_INITRD */
> -
>  static int __init early_init_dt_scan_chosen(unsigned long node,
>  				const char *uname, int depth, void *data)
>  {
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 7f88566..1ecd6c6 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -373,36 +373,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
>  	return 0;
>  }
>  
> -#ifdef CONFIG_BLK_DEV_INITRD
> -static void __init early_init_dt_check_for_initrd(unsigned long node)
> -{
> -	unsigned long l;
> -	u32 *prop;
> -
> -	DBG("Looking for initrd properties... ");
> -
> -	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
> -	if (prop) {
> -		initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
> -
> -		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
> -		if (prop) {
> -			initrd_end = (unsigned long)
> -					__va(of_read_ulong(prop, l/4));
> -			initrd_below_start_ok = 1;
> -		} else {
> -			initrd_start = 0;
> -		}
> -	}
> -
> -	DBG("initrd_start=0x%lx  initrd_end=0x%lx\n", initrd_start, initrd_end);
> -}
> -#else
> -static inline void early_init_dt_check_for_initrd(unsigned long node)
> -{
> -}
> -#endif /* CONFIG_BLK_DEV_INITRD */
> -
>  static int __init early_init_dt_scan_chosen(unsigned long node,
>  					    const char *uname, int depth, void *data)
>  {
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 43d236c..6ad98e8 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -11,6 +11,7 @@
>  
>  #include <linux/kernel.h>
>  #include <linux/lmb.h>
> +#include <linux/initrd.h>
>  #include <linux/of.h>
>  #include <linux/of_fdt.h>
>  
> @@ -369,6 +370,42 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
>  	return mem;
>  }
>  
> +#ifdef CONFIG_BLK_DEV_INITRD
> +/**
> + * early_init_dt_check_for_initrd - Decode initrd location from flat tree
> + * @node: reference to node containing initrd location ('chosen')
> + */
> +void __init early_init_dt_check_for_initrd(unsigned long node)
> +{
> +	unsigned long len;
> +	u32 *prop;
> +
> +	pr_debug("Looking for initrd properties... ");
> +
> +	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len);
> +	if (prop) {
> +		initrd_start = (unsigned long)
> +				__va(of_read_ulong(prop, len/4));
> +
> +		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len);
> +		if (prop) {
> +			initrd_end = (unsigned long)
> +				__va(of_read_ulong(prop, len/4));
> +			initrd_below_start_ok = 1;
> +		} else {
> +			initrd_start = 0;
> +		}
> +	}
> +
> +	pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
> +		 initrd_start, initrd_end);
> +}
> +#else
> +inline void early_init_dt_check_for_initrd(unsigned long node)
> +{
> +}
> +#endif /* CONFIG_BLK_DEV_INITRD */
> +
>  /**
>   * unflatten_device_tree - create tree of device_nodes from flat blob
>   *
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 81231e0..ec2db82 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -69,6 +69,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
>  				 unsigned long *size);
>  extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
>  extern unsigned long of_get_flat_dt_root(void);
> +extern void early_init_dt_check_for_initrd(unsigned long node);
>  
>  /* Other Prototypes */
>  extern void finish_device_tree(void);

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

* Re: [PATCH 01/11] of/flattree: Merge
@ 2009-11-26  3:51     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  3:51 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Tue, 2009-11-24 at 01:17 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
> Tested-by: Michal Simek <monstr@monstr.eu>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Remind me how you want to merge that ? via my tree ?

Cheers,
Ben.

> ---
> 
>  arch/microblaze/kernel/prom.c |   32 --------------------------------
>  arch/powerpc/kernel/prom.c    |   30 ------------------------------
>  drivers/of/fdt.c              |   37 +++++++++++++++++++++++++++++++++++++
>  include/linux/of_fdt.h        |    1 +
>  4 files changed, 38 insertions(+), 62 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index a38e373..7959495 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -113,38 +113,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
>  	return 0;
>  }
>  
> -#ifdef CONFIG_BLK_DEV_INITRD
> -static void __init early_init_dt_check_for_initrd(unsigned long node)
> -{
> -	unsigned long l;
> -	u32 *prop;
> -
> -	pr_debug("Looking for initrd properties... ");
> -
> -	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
> -	if (prop) {
> -		initrd_start = (unsigned long)
> -					__va((u32)of_read_ulong(prop, l/4));
> -
> -		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
> -		if (prop) {
> -			initrd_end = (unsigned long)
> -					__va((u32)of_read_ulong(prop, 1/4));
> -			initrd_below_start_ok = 1;
> -		} else {
> -			initrd_start = 0;
> -		}
> -	}
> -
> -	pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
> -					initrd_start, initrd_end);
> -}
> -#else
> -static inline void early_init_dt_check_for_initrd(unsigned long node)
> -{
> -}
> -#endif /* CONFIG_BLK_DEV_INITRD */
> -
>  static int __init early_init_dt_scan_chosen(unsigned long node,
>  				const char *uname, int depth, void *data)
>  {
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 7f88566..1ecd6c6 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -373,36 +373,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
>  	return 0;
>  }
>  
> -#ifdef CONFIG_BLK_DEV_INITRD
> -static void __init early_init_dt_check_for_initrd(unsigned long node)
> -{
> -	unsigned long l;
> -	u32 *prop;
> -
> -	DBG("Looking for initrd properties... ");
> -
> -	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
> -	if (prop) {
> -		initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
> -
> -		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
> -		if (prop) {
> -			initrd_end = (unsigned long)
> -					__va(of_read_ulong(prop, l/4));
> -			initrd_below_start_ok = 1;
> -		} else {
> -			initrd_start = 0;
> -		}
> -	}
> -
> -	DBG("initrd_start=0x%lx  initrd_end=0x%lx\n", initrd_start, initrd_end);
> -}
> -#else
> -static inline void early_init_dt_check_for_initrd(unsigned long node)
> -{
> -}
> -#endif /* CONFIG_BLK_DEV_INITRD */
> -
>  static int __init early_init_dt_scan_chosen(unsigned long node,
>  					    const char *uname, int depth, void *data)
>  {
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 43d236c..6ad98e8 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -11,6 +11,7 @@
>  
>  #include <linux/kernel.h>
>  #include <linux/lmb.h>
> +#include <linux/initrd.h>
>  #include <linux/of.h>
>  #include <linux/of_fdt.h>
>  
> @@ -369,6 +370,42 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
>  	return mem;
>  }
>  
> +#ifdef CONFIG_BLK_DEV_INITRD
> +/**
> + * early_init_dt_check_for_initrd - Decode initrd location from flat tree
> + * @node: reference to node containing initrd location ('chosen')
> + */
> +void __init early_init_dt_check_for_initrd(unsigned long node)
> +{
> +	unsigned long len;
> +	u32 *prop;
> +
> +	pr_debug("Looking for initrd properties... ");
> +
> +	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len);
> +	if (prop) {
> +		initrd_start = (unsigned long)
> +				__va(of_read_ulong(prop, len/4));
> +
> +		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len);
> +		if (prop) {
> +			initrd_end = (unsigned long)
> +				__va(of_read_ulong(prop, len/4));
> +			initrd_below_start_ok = 1;
> +		} else {
> +			initrd_start = 0;
> +		}
> +	}
> +
> +	pr_debug("initrd_start=0x%lx  initrd_end=0x%lx\n",
> +		 initrd_start, initrd_end);
> +}
> +#else
> +inline void early_init_dt_check_for_initrd(unsigned long node)
> +{
> +}
> +#endif /* CONFIG_BLK_DEV_INITRD */
> +
>  /**
>   * unflatten_device_tree - create tree of device_nodes from flat blob
>   *
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 81231e0..ec2db82 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -69,6 +69,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
>  				 unsigned long *size);
>  extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
>  extern unsigned long of_get_flat_dt_root(void);
> +extern void early_init_dt_check_for_initrd(unsigned long node);
>  
>  /* Other Prototypes */
>  extern void finish_device_tree(void);



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

* Re: [PATCH 02/11] of/flattree: Merge earlyinit_dt_scan_root()
  2009-11-24  8:18   ` Grant Likely
  (?)
@ 2009-11-26  3:54     ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  3:54 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze
> 
> Signed-off-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> ---

Ok with that, like the precendent, however you are making global some
symbols that were previously static which sucks a bit... But then they
can be made static again I suppose once more has been merged.

Ben.

>  arch/microblaze/kernel/prom.c |   23 -----------------------
>  arch/powerpc/kernel/prom.c    |   24 ------------------------
>  drivers/of/fdt.c              |   26 ++++++++++++++++++++++++++
>  include/linux/of_fdt.h        |    6 ++++++
>  4 files changed, 32 insertions(+), 47 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index 7959495..189179a 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -42,9 +42,6 @@
>  #include <asm/sections.h>
>  #include <asm/pci-bridge.h>
>  
> -static int __initdata dt_root_addr_cells;
> -static int __initdata dt_root_size_cells;
> -
>  typedef u32 cell_t;
>  
>  /* export that to outside world */
> @@ -158,26 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static int __init early_init_dt_scan_root(unsigned long node,
> -				const char *uname, int depth, void *data)
> -{
> -	u32 *prop;
> -
> -	if (depth != 0)
> -		return 0;
> -
> -	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> -	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
> -	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
> -
> -	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
> -	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
> -	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
> -
> -	/* break now */
> -	return 1;
> -}
> -
>  static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
>  {
>  	cell_t *p = *cellp;
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 1ecd6c6..78f65a4 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -61,10 +61,6 @@
>  #define DBG(fmt...)
>  #endif
>  
> -
> -static int __initdata dt_root_addr_cells;
> -static int __initdata dt_root_size_cells;
> -
>  #ifdef CONFIG_PPC64
>  int __initdata iommu_is_off;
>  int __initdata iommu_force_on;
> @@ -436,26 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static int __init early_init_dt_scan_root(unsigned long node,
> -					  const char *uname, int depth, void *data)
> -{
> -	u32 *prop;
> -
> -	if (depth != 0)
> -		return 0;
> -
> -	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> -	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
> -	DBG("dt_root_size_cells = %x\n", dt_root_size_cells);
> -
> -	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
> -	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
> -	DBG("dt_root_addr_cells = %x\n", dt_root_addr_cells);
> -	
> -	/* break now */
> -	return 1;
> -}
> -
>  static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
>  {
>  	cell_t *p = *cellp;
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 6ad98e8..be200be 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -15,6 +15,9 @@
>  #include <linux/of.h>
>  #include <linux/of_fdt.h>
>  
> +int __initdata dt_root_addr_cells;
> +int __initdata dt_root_size_cells;
> +
>  struct boot_param_header *initial_boot_params;
>  
>  char *find_flat_dt_string(u32 offset)
> @@ -407,6 +410,29 @@ inline void early_init_dt_check_for_initrd(unsigned long node)
>  #endif /* CONFIG_BLK_DEV_INITRD */
>  
>  /**
> + * early_init_dt_scan_root - fetch the top level address and size cells
> + */
> +int __init early_init_dt_scan_root(unsigned long node, const char *uname,
> +				   int depth, void *data)
> +{
> +	u32 *prop;
> +
> +	if (depth != 0)
> +		return 0;
> +
> +	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> +	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
> +	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
> +
> +	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
> +	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
> +	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
> +
> +	/* break now */
> +	return 1;
> +}
> +
> +/**
>   * unflatten_device_tree - create tree of device_nodes from flat blob
>   *
>   * unflattens the device-tree passed by the firmware, creating the
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index ec2db82..828c3cd 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -58,6 +58,8 @@ struct boot_param_header {
>  };
>  
>  /* TBD: Temporary export of fdt globals - remove when code fully merged */
> +extern int __initdata dt_root_addr_cells;
> +extern int __initdata dt_root_size_cells;
>  extern struct boot_param_header *initial_boot_params;
>  
>  /* For scanning the flat device-tree at boot time */
> @@ -71,6 +73,10 @@ extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
>  extern unsigned long of_get_flat_dt_root(void);
>  extern void early_init_dt_check_for_initrd(unsigned long node);
>  
> +/* Early flat tree scan hooks */
> +extern int early_init_dt_scan_root(unsigned long node, const char *uname,
> +				   int depth, void *data);
> +
>  /* Other Prototypes */
>  extern void finish_device_tree(void);
>  extern void unflatten_device_tree(void);

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

* Re: [PATCH 02/11] of/flattree: Merge earlyinit_dt_scan_root()
@ 2009-11-26  3:54     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  3:54 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---

Ok with that, like the precendent, however you are making global some
symbols that were previously static which sucks a bit... But then they
can be made static again I suppose once more has been merged.

Ben.

>  arch/microblaze/kernel/prom.c |   23 -----------------------
>  arch/powerpc/kernel/prom.c    |   24 ------------------------
>  drivers/of/fdt.c              |   26 ++++++++++++++++++++++++++
>  include/linux/of_fdt.h        |    6 ++++++
>  4 files changed, 32 insertions(+), 47 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index 7959495..189179a 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -42,9 +42,6 @@
>  #include <asm/sections.h>
>  #include <asm/pci-bridge.h>
>  
> -static int __initdata dt_root_addr_cells;
> -static int __initdata dt_root_size_cells;
> -
>  typedef u32 cell_t;
>  
>  /* export that to outside world */
> @@ -158,26 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static int __init early_init_dt_scan_root(unsigned long node,
> -				const char *uname, int depth, void *data)
> -{
> -	u32 *prop;
> -
> -	if (depth != 0)
> -		return 0;
> -
> -	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> -	dt_root_size_cells = (prop = NULL) ? 1 : *prop;
> -	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
> -
> -	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
> -	dt_root_addr_cells = (prop = NULL) ? 2 : *prop;
> -	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
> -
> -	/* break now */
> -	return 1;
> -}
> -
>  static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
>  {
>  	cell_t *p = *cellp;
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 1ecd6c6..78f65a4 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -61,10 +61,6 @@
>  #define DBG(fmt...)
>  #endif
>  
> -
> -static int __initdata dt_root_addr_cells;
> -static int __initdata dt_root_size_cells;
> -
>  #ifdef CONFIG_PPC64
>  int __initdata iommu_is_off;
>  int __initdata iommu_force_on;
> @@ -436,26 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static int __init early_init_dt_scan_root(unsigned long node,
> -					  const char *uname, int depth, void *data)
> -{
> -	u32 *prop;
> -
> -	if (depth != 0)
> -		return 0;
> -
> -	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> -	dt_root_size_cells = (prop = NULL) ? 1 : *prop;
> -	DBG("dt_root_size_cells = %x\n", dt_root_size_cells);
> -
> -	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
> -	dt_root_addr_cells = (prop = NULL) ? 2 : *prop;
> -	DBG("dt_root_addr_cells = %x\n", dt_root_addr_cells);
> -	
> -	/* break now */
> -	return 1;
> -}
> -
>  static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
>  {
>  	cell_t *p = *cellp;
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 6ad98e8..be200be 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -15,6 +15,9 @@
>  #include <linux/of.h>
>  #include <linux/of_fdt.h>
>  
> +int __initdata dt_root_addr_cells;
> +int __initdata dt_root_size_cells;
> +
>  struct boot_param_header *initial_boot_params;
>  
>  char *find_flat_dt_string(u32 offset)
> @@ -407,6 +410,29 @@ inline void early_init_dt_check_for_initrd(unsigned long node)
>  #endif /* CONFIG_BLK_DEV_INITRD */
>  
>  /**
> + * early_init_dt_scan_root - fetch the top level address and size cells
> + */
> +int __init early_init_dt_scan_root(unsigned long node, const char *uname,
> +				   int depth, void *data)
> +{
> +	u32 *prop;
> +
> +	if (depth != 0)
> +		return 0;
> +
> +	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> +	dt_root_size_cells = (prop = NULL) ? 1 : *prop;
> +	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
> +
> +	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
> +	dt_root_addr_cells = (prop = NULL) ? 2 : *prop;
> +	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
> +
> +	/* break now */
> +	return 1;
> +}
> +
> +/**
>   * unflatten_device_tree - create tree of device_nodes from flat blob
>   *
>   * unflattens the device-tree passed by the firmware, creating the
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index ec2db82..828c3cd 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -58,6 +58,8 @@ struct boot_param_header {
>  };
>  
>  /* TBD: Temporary export of fdt globals - remove when code fully merged */
> +extern int __initdata dt_root_addr_cells;
> +extern int __initdata dt_root_size_cells;
>  extern struct boot_param_header *initial_boot_params;
>  
>  /* For scanning the flat device-tree at boot time */
> @@ -71,6 +73,10 @@ extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
>  extern unsigned long of_get_flat_dt_root(void);
>  extern void early_init_dt_check_for_initrd(unsigned long node);
>  
> +/* Early flat tree scan hooks */
> +extern int early_init_dt_scan_root(unsigned long node, const char *uname,
> +				   int depth, void *data);
> +
>  /* Other Prototypes */
>  extern void finish_device_tree(void);
>  extern void unflatten_device_tree(void);



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

* Re: [PATCH 02/11] of/flattree: Merge earlyinit_dt_scan_root()
@ 2009-11-26  3:54     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  3:54 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---

Ok with that, like the precendent, however you are making global some
symbols that were previously static which sucks a bit... But then they
can be made static again I suppose once more has been merged.

Ben.

>  arch/microblaze/kernel/prom.c |   23 -----------------------
>  arch/powerpc/kernel/prom.c    |   24 ------------------------
>  drivers/of/fdt.c              |   26 ++++++++++++++++++++++++++
>  include/linux/of_fdt.h        |    6 ++++++
>  4 files changed, 32 insertions(+), 47 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index 7959495..189179a 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -42,9 +42,6 @@
>  #include <asm/sections.h>
>  #include <asm/pci-bridge.h>
>  
> -static int __initdata dt_root_addr_cells;
> -static int __initdata dt_root_size_cells;
> -
>  typedef u32 cell_t;
>  
>  /* export that to outside world */
> @@ -158,26 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static int __init early_init_dt_scan_root(unsigned long node,
> -				const char *uname, int depth, void *data)
> -{
> -	u32 *prop;
> -
> -	if (depth != 0)
> -		return 0;
> -
> -	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> -	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
> -	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
> -
> -	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
> -	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
> -	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
> -
> -	/* break now */
> -	return 1;
> -}
> -
>  static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
>  {
>  	cell_t *p = *cellp;
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 1ecd6c6..78f65a4 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -61,10 +61,6 @@
>  #define DBG(fmt...)
>  #endif
>  
> -
> -static int __initdata dt_root_addr_cells;
> -static int __initdata dt_root_size_cells;
> -
>  #ifdef CONFIG_PPC64
>  int __initdata iommu_is_off;
>  int __initdata iommu_force_on;
> @@ -436,26 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static int __init early_init_dt_scan_root(unsigned long node,
> -					  const char *uname, int depth, void *data)
> -{
> -	u32 *prop;
> -
> -	if (depth != 0)
> -		return 0;
> -
> -	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> -	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
> -	DBG("dt_root_size_cells = %x\n", dt_root_size_cells);
> -
> -	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
> -	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
> -	DBG("dt_root_addr_cells = %x\n", dt_root_addr_cells);
> -	
> -	/* break now */
> -	return 1;
> -}
> -
>  static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
>  {
>  	cell_t *p = *cellp;
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 6ad98e8..be200be 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -15,6 +15,9 @@
>  #include <linux/of.h>
>  #include <linux/of_fdt.h>
>  
> +int __initdata dt_root_addr_cells;
> +int __initdata dt_root_size_cells;
> +
>  struct boot_param_header *initial_boot_params;
>  
>  char *find_flat_dt_string(u32 offset)
> @@ -407,6 +410,29 @@ inline void early_init_dt_check_for_initrd(unsigned long node)
>  #endif /* CONFIG_BLK_DEV_INITRD */
>  
>  /**
> + * early_init_dt_scan_root - fetch the top level address and size cells
> + */
> +int __init early_init_dt_scan_root(unsigned long node, const char *uname,
> +				   int depth, void *data)
> +{
> +	u32 *prop;
> +
> +	if (depth != 0)
> +		return 0;
> +
> +	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> +	dt_root_size_cells = (prop == NULL) ? 1 : *prop;
> +	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
> +
> +	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
> +	dt_root_addr_cells = (prop == NULL) ? 2 : *prop;
> +	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
> +
> +	/* break now */
> +	return 1;
> +}
> +
> +/**
>   * unflatten_device_tree - create tree of device_nodes from flat blob
>   *
>   * unflattens the device-tree passed by the firmware, creating the
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index ec2db82..828c3cd 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -58,6 +58,8 @@ struct boot_param_header {
>  };
>  
>  /* TBD: Temporary export of fdt globals - remove when code fully merged */
> +extern int __initdata dt_root_addr_cells;
> +extern int __initdata dt_root_size_cells;
>  extern struct boot_param_header *initial_boot_params;
>  
>  /* For scanning the flat device-tree at boot time */
> @@ -71,6 +73,10 @@ extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
>  extern unsigned long of_get_flat_dt_root(void);
>  extern void early_init_dt_check_for_initrd(unsigned long node);
>  
> +/* Early flat tree scan hooks */
> +extern int early_init_dt_scan_root(unsigned long node, const char *uname,
> +				   int depth, void *data);
> +
>  /* Other Prototypes */
>  extern void finish_device_tree(void);
>  extern void unflatten_device_tree(void);

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

* Re: [PATCH 03/11] of/flattree: merge dt_mem_next_cell
  2009-11-24  8:18   ` Grant Likely
  (?)
@ 2009-11-26  3:55     ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  3:55 UTC (permalink / raw)
  To: Grant Likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> 
>  arch/microblaze/kernel/prom.c |    8 --------
>  arch/powerpc/kernel/prom.c    |    8 --------
>  drivers/of/fdt.c              |    8 ++++++++
>  include/linux/of_fdt.h        |    1 +
>  4 files changed, 9 insertions(+), 16 deletions(-)

Same comment here, something goes from static to global... do you plan
to make things back to static in the end ?

Ben.

> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index 189179a..e0f4c34 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -155,14 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
> -{
> -	cell_t *p = *cellp;
> -
> -	*cellp = p + s;
> -	return of_read_number(p, s);
> -}
> -
>  static int __init early_init_dt_scan_memory(unsigned long node,
>  				const char *uname, int depth, void *data)
>  {
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 78f65a4..048e3a3 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -432,14 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
> -{
> -	cell_t *p = *cellp;
> -
> -	*cellp = p + s;
> -	return of_read_number(p, s);
> -}
> -
>  #ifdef CONFIG_PPC_PSERIES
>  /*
>   * Interpret the ibm,dynamic-memory property in the
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index be200be..ebce509 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -432,6 +432,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
>  	return 1;
>  }
>  
> +u64 __init dt_mem_next_cell(int s, u32 **cellp)
> +{
> +	u32 *p = *cellp;
> +
> +	*cellp = p + s;
> +	return of_read_number(p, s);
> +}
> +
>  /**
>   * unflatten_device_tree - create tree of device_nodes from flat blob
>   *
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 828c3cd..d1a37e5 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -72,6 +72,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
>  extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
>  extern unsigned long of_get_flat_dt_root(void);
>  extern void early_init_dt_check_for_initrd(unsigned long node);
> +extern u64 dt_mem_next_cell(int s, u32 **cellp);
>  
>  /* Early flat tree scan hooks */
>  extern int early_init_dt_scan_root(unsigned long node, const char *uname,



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

* Re: [PATCH 03/11] of/flattree: merge dt_mem_next_cell
@ 2009-11-26  3:55     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  3:55 UTC (permalink / raw)
  To: Grant Likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> 
>  arch/microblaze/kernel/prom.c |    8 --------
>  arch/powerpc/kernel/prom.c    |    8 --------
>  drivers/of/fdt.c              |    8 ++++++++
>  include/linux/of_fdt.h        |    1 +
>  4 files changed, 9 insertions(+), 16 deletions(-)

Same comment here, something goes from static to global... do you plan
to make things back to static in the end ?

Ben.

> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index 189179a..e0f4c34 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -155,14 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
> -{
> -	cell_t *p = *cellp;
> -
> -	*cellp = p + s;
> -	return of_read_number(p, s);
> -}
> -
>  static int __init early_init_dt_scan_memory(unsigned long node,
>  				const char *uname, int depth, void *data)
>  {
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 78f65a4..048e3a3 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -432,14 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
> -{
> -	cell_t *p = *cellp;
> -
> -	*cellp = p + s;
> -	return of_read_number(p, s);
> -}
> -
>  #ifdef CONFIG_PPC_PSERIES
>  /*
>   * Interpret the ibm,dynamic-memory property in the
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index be200be..ebce509 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -432,6 +432,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
>  	return 1;
>  }
>  
> +u64 __init dt_mem_next_cell(int s, u32 **cellp)
> +{
> +	u32 *p = *cellp;
> +
> +	*cellp = p + s;
> +	return of_read_number(p, s);
> +}
> +
>  /**
>   * unflatten_device_tree - create tree of device_nodes from flat blob
>   *
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 828c3cd..d1a37e5 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -72,6 +72,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
>  extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
>  extern unsigned long of_get_flat_dt_root(void);
>  extern void early_init_dt_check_for_initrd(unsigned long node);
> +extern u64 dt_mem_next_cell(int s, u32 **cellp);
>  
>  /* Early flat tree scan hooks */
>  extern int early_init_dt_scan_root(unsigned long node, const char *uname,



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

* Re: [PATCH 03/11] of/flattree: merge dt_mem_next_cell
@ 2009-11-26  3:55     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  3:55 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> 
>  arch/microblaze/kernel/prom.c |    8 --------
>  arch/powerpc/kernel/prom.c    |    8 --------
>  drivers/of/fdt.c              |    8 ++++++++
>  include/linux/of_fdt.h        |    1 +
>  4 files changed, 9 insertions(+), 16 deletions(-)

Same comment here, something goes from static to global... do you plan
to make things back to static in the end ?

Ben.

> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index 189179a..e0f4c34 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -155,14 +155,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
> -{
> -	cell_t *p = *cellp;
> -
> -	*cellp = p + s;
> -	return of_read_number(p, s);
> -}
> -
>  static int __init early_init_dt_scan_memory(unsigned long node,
>  				const char *uname, int depth, void *data)
>  {
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 78f65a4..048e3a3 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -432,14 +432,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>  	return 1;
>  }
>  
> -static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
> -{
> -	cell_t *p = *cellp;
> -
> -	*cellp = p + s;
> -	return of_read_number(p, s);
> -}
> -
>  #ifdef CONFIG_PPC_PSERIES
>  /*
>   * Interpret the ibm,dynamic-memory property in the
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index be200be..ebce509 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -432,6 +432,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
>  	return 1;
>  }
>  
> +u64 __init dt_mem_next_cell(int s, u32 **cellp)
> +{
> +	u32 *p = *cellp;
> +
> +	*cellp = p + s;
> +	return of_read_number(p, s);
> +}
> +
>  /**
>   * unflatten_device_tree - create tree of device_nodes from flat blob
>   *
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 828c3cd..d1a37e5 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -72,6 +72,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
>  extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
>  extern unsigned long of_get_flat_dt_root(void);
>  extern void early_init_dt_check_for_initrd(unsigned long node);
> +extern u64 dt_mem_next_cell(int s, u32 **cellp);
>  
>  /* Early flat tree scan hooks */
>  extern int early_init_dt_scan_root(unsigned long node, const char *uname,

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
  2009-11-24  8:18   ` Grant Likely
  (?)
@ 2009-11-26  3:59     ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  3:59 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
> A cell is firmly established as a u32.  No need to do an ugly typedef
> to redefine it to cell_t.  Eliminate the unnecessary typedef so that
> it doesn't have to be added to the of_fdt header file
> 
> Signed-off-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> ---

I'm not sure about that one. Yes, we do use u32 a lot and cell_t rarely,
so it would seem logical to switch.... On the other hand, we have that
pesky endianness issue we have never fully solved. So we need accessors
to sort that out, which means directly tapping things as u32 * is not a
good idea if we're going to enforce the use of such accessors.

I believe we should probably just enforce that properties are big endian
for flat device-trees. In which case we could just use __be32 or on of
thoes sparse-friendly types. I know x86 people won't like that much and
to be honest I don't know what 1295 specifies for real OFs but there
aren't enough real OFs around on LE machines for us to care much about
it, is there ?

The reason I prefer a fixed endianness is that allowing "LE" trees
becomes really nasty when a number is expressed using multiple cells.
That brings the question as to whether the two cells need to be flipped
as well or only the bytes within each cell. And that's the easy bit
(probably flip the whole thing). What about something like a PCI "reg"
property which is made of 3 cells, two of them forming a 64-bit address
and one containing additional data & attributes ? What is flipped and
where ?

So yes, cell_t might not be the right approach and by far to generic a
name, but u32 isn't the answer neither.

Cheers,
Ben. 

>  arch/microblaze/kernel/prom.c |   10 ++++------
>  arch/powerpc/kernel/prom.c    |   14 ++++++--------
>  2 files changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index e0f4c34..7760186 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -42,8 +42,6 @@
>  #include <asm/sections.h>
>  #include <asm/pci-bridge.h>
>  
> -typedef u32 cell_t;
> -
>  /* export that to outside world */
>  struct device_node *of_chosen;
>  
> @@ -159,7 +157,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  				const char *uname, int depth, void *data)
>  {
>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> -	cell_t *reg, *endp;
> +	u32 *reg, *endp;
>  	unsigned long l;
>  
>  	/* Look for the ibm,dynamic-reconfiguration-memory node */
> @@ -178,13 +176,13 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  	} else if (strcmp(type, "memory") != 0)
>  		return 0;
>  
> -	reg = (cell_t *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
> +	reg = (u32 *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
>  	if (reg == NULL)
> -		reg = (cell_t *)of_get_flat_dt_prop(node, "reg", &l);
> +		reg = (u32 *)of_get_flat_dt_prop(node, "reg", &l);
>  	if (reg == NULL)
>  		return 0;
>  
> -	endp = reg + (l / sizeof(cell_t));
> +	endp = reg + (l / sizeof(u32));
>  
>  	pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
>  		uname, l, reg[0], reg[1], reg[2], reg[3]);
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 048e3a3..43cdba2 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -67,8 +67,6 @@ int __initdata iommu_force_on;
>  unsigned long tce_alloc_start, tce_alloc_end;
>  #endif
>  
> -typedef u32 cell_t;
> -
>  extern rwlock_t devtree_lock;	/* temporary while merging */
>  
>  /* export that to outside world */
> @@ -441,22 +439,22 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>   */
>  static int __init early_init_dt_scan_drconf_memory(unsigned long node)
>  {
> -	cell_t *dm, *ls, *usm;
> +	u32 *dm, *ls, *usm;
>  	unsigned long l, n, flags;
>  	u64 base, size, lmb_size;
>  	unsigned int is_kexec_kdump = 0, rngs;
>  
>  	ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
> -	if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t))
> +	if (ls == NULL || l < dt_root_size_cells * sizeof(u32))
>  		return 0;
>  	lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls);
>  
>  	dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l);
> -	if (dm == NULL || l < sizeof(cell_t))
> +	if (dm == NULL || l < sizeof(u32))
>  		return 0;
>  
>  	n = *dm++;	/* number of entries */
> -	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t))
> +	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(u32))
>  		return 0;
>  
>  	/* check if this is a kexec/kdump kernel. */
> @@ -515,7 +513,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  					    const char *uname, int depth, void *data)
>  {
>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> -	cell_t *reg, *endp;
> +	u32 *reg, *endp;
>  	unsigned long l;
>  
>  	/* Look for the ibm,dynamic-reconfiguration-memory node */
> @@ -540,7 +538,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  	if (reg == NULL)
>  		return 0;
>  
> -	endp = reg + (l / sizeof(cell_t));
> +	endp = reg + (l / sizeof(u32));
>  
>  	DBG("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
>  	    uname, l, reg[0], reg[1], reg[2], reg[3]);

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26  3:59     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  3:59 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
> A cell is firmly established as a u32.  No need to do an ugly typedef
> to redefine it to cell_t.  Eliminate the unnecessary typedef so that
> it doesn't have to be added to the of_fdt header file
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---

I'm not sure about that one. Yes, we do use u32 a lot and cell_t rarely,
so it would seem logical to switch.... On the other hand, we have that
pesky endianness issue we have never fully solved. So we need accessors
to sort that out, which means directly tapping things as u32 * is not a
good idea if we're going to enforce the use of such accessors.

I believe we should probably just enforce that properties are big endian
for flat device-trees. In which case we could just use __be32 or on of
thoes sparse-friendly types. I know x86 people won't like that much and
to be honest I don't know what 1295 specifies for real OFs but there
aren't enough real OFs around on LE machines for us to care much about
it, is there ?

The reason I prefer a fixed endianness is that allowing "LE" trees
becomes really nasty when a number is expressed using multiple cells.
That brings the question as to whether the two cells need to be flipped
as well or only the bytes within each cell. And that's the easy bit
(probably flip the whole thing). What about something like a PCI "reg"
property which is made of 3 cells, two of them forming a 64-bit address
and one containing additional data & attributes ? What is flipped and
where ?

So yes, cell_t might not be the right approach and by far to generic a
name, but u32 isn't the answer neither.

Cheers,
Ben. 

>  arch/microblaze/kernel/prom.c |   10 ++++------
>  arch/powerpc/kernel/prom.c    |   14 ++++++--------
>  2 files changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index e0f4c34..7760186 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -42,8 +42,6 @@
>  #include <asm/sections.h>
>  #include <asm/pci-bridge.h>
>  
> -typedef u32 cell_t;
> -
>  /* export that to outside world */
>  struct device_node *of_chosen;
>  
> @@ -159,7 +157,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  				const char *uname, int depth, void *data)
>  {
>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> -	cell_t *reg, *endp;
> +	u32 *reg, *endp;
>  	unsigned long l;
>  
>  	/* Look for the ibm,dynamic-reconfiguration-memory node */
> @@ -178,13 +176,13 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  	} else if (strcmp(type, "memory") != 0)
>  		return 0;
>  
> -	reg = (cell_t *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
> +	reg = (u32 *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
>  	if (reg = NULL)
> -		reg = (cell_t *)of_get_flat_dt_prop(node, "reg", &l);
> +		reg = (u32 *)of_get_flat_dt_prop(node, "reg", &l);
>  	if (reg = NULL)
>  		return 0;
>  
> -	endp = reg + (l / sizeof(cell_t));
> +	endp = reg + (l / sizeof(u32));
>  
>  	pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
>  		uname, l, reg[0], reg[1], reg[2], reg[3]);
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 048e3a3..43cdba2 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -67,8 +67,6 @@ int __initdata iommu_force_on;
>  unsigned long tce_alloc_start, tce_alloc_end;
>  #endif
>  
> -typedef u32 cell_t;
> -
>  extern rwlock_t devtree_lock;	/* temporary while merging */
>  
>  /* export that to outside world */
> @@ -441,22 +439,22 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>   */
>  static int __init early_init_dt_scan_drconf_memory(unsigned long node)
>  {
> -	cell_t *dm, *ls, *usm;
> +	u32 *dm, *ls, *usm;
>  	unsigned long l, n, flags;
>  	u64 base, size, lmb_size;
>  	unsigned int is_kexec_kdump = 0, rngs;
>  
>  	ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
> -	if (ls = NULL || l < dt_root_size_cells * sizeof(cell_t))
> +	if (ls = NULL || l < dt_root_size_cells * sizeof(u32))
>  		return 0;
>  	lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls);
>  
>  	dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l);
> -	if (dm = NULL || l < sizeof(cell_t))
> +	if (dm = NULL || l < sizeof(u32))
>  		return 0;
>  
>  	n = *dm++;	/* number of entries */
> -	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t))
> +	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(u32))
>  		return 0;
>  
>  	/* check if this is a kexec/kdump kernel. */
> @@ -515,7 +513,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  					    const char *uname, int depth, void *data)
>  {
>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> -	cell_t *reg, *endp;
> +	u32 *reg, *endp;
>  	unsigned long l;
>  
>  	/* Look for the ibm,dynamic-reconfiguration-memory node */
> @@ -540,7 +538,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  	if (reg = NULL)
>  		return 0;
>  
> -	endp = reg + (l / sizeof(cell_t));
> +	endp = reg + (l / sizeof(u32));
>  
>  	DBG("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
>  	    uname, l, reg[0], reg[1], reg[2], reg[3]);



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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26  3:59     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  3:59 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
> A cell is firmly established as a u32.  No need to do an ugly typedef
> to redefine it to cell_t.  Eliminate the unnecessary typedef so that
> it doesn't have to be added to the of_fdt header file
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---

I'm not sure about that one. Yes, we do use u32 a lot and cell_t rarely,
so it would seem logical to switch.... On the other hand, we have that
pesky endianness issue we have never fully solved. So we need accessors
to sort that out, which means directly tapping things as u32 * is not a
good idea if we're going to enforce the use of such accessors.

I believe we should probably just enforce that properties are big endian
for flat device-trees. In which case we could just use __be32 or on of
thoes sparse-friendly types. I know x86 people won't like that much and
to be honest I don't know what 1295 specifies for real OFs but there
aren't enough real OFs around on LE machines for us to care much about
it, is there ?

The reason I prefer a fixed endianness is that allowing "LE" trees
becomes really nasty when a number is expressed using multiple cells.
That brings the question as to whether the two cells need to be flipped
as well or only the bytes within each cell. And that's the easy bit
(probably flip the whole thing). What about something like a PCI "reg"
property which is made of 3 cells, two of them forming a 64-bit address
and one containing additional data & attributes ? What is flipped and
where ?

So yes, cell_t might not be the right approach and by far to generic a
name, but u32 isn't the answer neither.

Cheers,
Ben. 

>  arch/microblaze/kernel/prom.c |   10 ++++------
>  arch/powerpc/kernel/prom.c    |   14 ++++++--------
>  2 files changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index e0f4c34..7760186 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -42,8 +42,6 @@
>  #include <asm/sections.h>
>  #include <asm/pci-bridge.h>
>  
> -typedef u32 cell_t;
> -
>  /* export that to outside world */
>  struct device_node *of_chosen;
>  
> @@ -159,7 +157,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  				const char *uname, int depth, void *data)
>  {
>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> -	cell_t *reg, *endp;
> +	u32 *reg, *endp;
>  	unsigned long l;
>  
>  	/* Look for the ibm,dynamic-reconfiguration-memory node */
> @@ -178,13 +176,13 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  	} else if (strcmp(type, "memory") != 0)
>  		return 0;
>  
> -	reg = (cell_t *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
> +	reg = (u32 *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
>  	if (reg == NULL)
> -		reg = (cell_t *)of_get_flat_dt_prop(node, "reg", &l);
> +		reg = (u32 *)of_get_flat_dt_prop(node, "reg", &l);
>  	if (reg == NULL)
>  		return 0;
>  
> -	endp = reg + (l / sizeof(cell_t));
> +	endp = reg + (l / sizeof(u32));
>  
>  	pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
>  		uname, l, reg[0], reg[1], reg[2], reg[3]);
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 048e3a3..43cdba2 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -67,8 +67,6 @@ int __initdata iommu_force_on;
>  unsigned long tce_alloc_start, tce_alloc_end;
>  #endif
>  
> -typedef u32 cell_t;
> -
>  extern rwlock_t devtree_lock;	/* temporary while merging */
>  
>  /* export that to outside world */
> @@ -441,22 +439,22 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
>   */
>  static int __init early_init_dt_scan_drconf_memory(unsigned long node)
>  {
> -	cell_t *dm, *ls, *usm;
> +	u32 *dm, *ls, *usm;
>  	unsigned long l, n, flags;
>  	u64 base, size, lmb_size;
>  	unsigned int is_kexec_kdump = 0, rngs;
>  
>  	ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
> -	if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t))
> +	if (ls == NULL || l < dt_root_size_cells * sizeof(u32))
>  		return 0;
>  	lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls);
>  
>  	dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l);
> -	if (dm == NULL || l < sizeof(cell_t))
> +	if (dm == NULL || l < sizeof(u32))
>  		return 0;
>  
>  	n = *dm++;	/* number of entries */
> -	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t))
> +	if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(u32))
>  		return 0;
>  
>  	/* check if this is a kexec/kdump kernel. */
> @@ -515,7 +513,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  					    const char *uname, int depth, void *data)
>  {
>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> -	cell_t *reg, *endp;
> +	u32 *reg, *endp;
>  	unsigned long l;
>  
>  	/* Look for the ibm,dynamic-reconfiguration-memory node */
> @@ -540,7 +538,7 @@ static int __init early_init_dt_scan_memory(unsigned long node,
>  	if (reg == NULL)
>  		return 0;
>  
> -	endp = reg + (l / sizeof(cell_t));
> +	endp = reg + (l / sizeof(u32));
>  
>  	DBG("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
>  	    uname, l, reg[0], reg[1], reg[2], reg[3]);

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

* Re: [PATCH 01/11] of/flattree: Merge early_init_dt_check_for_initrd()
  2009-11-26  3:51     ` [PATCH 01/11] of/flattree: Merge Benjamin Herrenschmidt
  (?)
@ 2009-11-26  4:02       ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-26  4:02 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Wed, Nov 25, 2009 at 8:51 PM, Benjamin Herrenschmidt
<benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org> wrote:
> On Tue, 2009-11-24 at 01:17 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>>
>> Signed-off-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
>> Reviewed-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>> Tested-by: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
>
> Acked-by: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
>
> Remind me how you want to merge that ? via my tree ?

Since it is cross-arch, I'll ask Linus to pull directly.  We'll see if
that takes.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 01/11] of/flattree: Merge early_init_dt_check_for_initrd()
@ 2009-11-26  4:02       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-26  4:02 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Wed, Nov 25, 2009 at 8:51 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:17 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>>
>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
>> Tested-by: Michal Simek <monstr@monstr.eu>
>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> Remind me how you want to merge that ? via my tree ?

Since it is cross-arch, I'll ask Linus to pull directly.  We'll see if
that takes.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 01/11] of/flattree: Merge early_init_dt_check_for_initrd()
@ 2009-11-26  4:02       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-26  4:02 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Wed, Nov 25, 2009 at 8:51 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:17 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>>
>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
>> Tested-by: Michal Simek <monstr@monstr.eu>
>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> Remind me how you want to merge that ? via my tree ?

Since it is cross-arch, I'll ask Linus to pull directly.  We'll see if
that takes.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 02/11] of/flattree: Merge earlyinit_dt_scan_root()
  2009-11-26  3:54     ` Benjamin Herrenschmidt
  (?)
@ 2009-11-26  4:03       ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-26  4:03 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Wed, Nov 25, 2009 at 8:54 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>>
>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>> ---
>
> Ok with that, like the precendent, however you are making global some
> symbols that were previously static which sucks a bit... But then they
> can be made static again I suppose once more has been merged.

exactly.  My plan is: 1) merge.  2) refactor (and make things static
again)  3) port to ARM  4) ????  5) profit.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 02/11] of/flattree: Merge earlyinit_dt_scan_root()
@ 2009-11-26  4:03       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-26  4:03 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Wed, Nov 25, 2009 at 8:54 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>>
>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>> ---
>
> Ok with that, like the precendent, however you are making global some
> symbols that were previously static which sucks a bit... But then they
> can be made static again I suppose once more has been merged.

exactly.  My plan is: 1) merge.  2) refactor (and make things static
again)  3) port to ARM  4) ????  5) profit.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 02/11] of/flattree: Merge earlyinit_dt_scan_root()
@ 2009-11-26  4:03       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-26  4:03 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Wed, Nov 25, 2009 at 8:54 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>>
>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>> ---
>
> Ok with that, like the precendent, however you are making global some
> symbols that were previously static which sucks a bit... But then they
> can be made static again I suppose once more has been merged.

exactly.  My plan is: 1) merge.  2) refactor (and make things static
again)  3) port to ARM  4) ????  5) profit.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree()
  2009-11-24  8:19   ` [PATCH 06/11] of/flattree: merge early_init_devtree() and Grant Likely
  (?)
@ 2009-11-26  4:04     ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:04 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:

>  
> -static int __init early_init_dt_scan_cpus(unsigned long node,
> -					  const char *uname, int depth,
> -					  void *data)
> +int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
> +				   int depth, void *data)
>  {

So now you make this one non-static as well with little hope of making
it static ever again

>  	static int logical_cpuid;
>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> @@ -113,8 +112,8 @@ void __init early_init_dt_scan_chosen_arch(unsigned long node)
>  	/* No Microblaze specific code here */
>  }
>  
> -static int __init early_init_dt_scan_memory(unsigned long node,
> -				const char *uname, int depth, void *data)
> +int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
> +				     int depth, void *data)
>  {

And this one

>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
>  	u32 *reg, *endp;
> @@ -201,7 +200,7 @@ static inline unsigned long phyp_dump_calculate_reserve_size(void)
>   * without reserving anything. The memory in case of dump being
>   * active is freed when the dump is collected (by userland tools).
>   */
> -static void __init phyp_dump_reserve_mem(void)
> +void __init phyp_dump_reserve_mem(void)
>  {

And this one...

>  /**
> + * early_init_move_devtree - move tree to an unused area, if needed.
> + *
> + * The device tree may be allocated beyond our memory limit, or inside the
> + * crash kernel region for kdump. If so, move it out of the way.
> + */
> +#if defined(CONFIG_PPC)
> +static void __init early_init_move_devtree(void)

And you still end up with an ifdef mess in the common code ...

Would it be possible instead to have one common early_init_devtree()
that calls into the "common" ones (which you can then make static again,
inside the common code) and then calls one arch_early_init_devtree()
which regroups the arch specific ones ?

Or there's too many ordering issues ?

Another option then is to call from that early_init_devtree() something
like:

	arch_early_init_dt_mem()
	arch_early_init_dt_cpu()
	arch_early_init_move_devtree()

etc... in the right spots in the common code and have the archs who
don't do anything there just have them as empty inlines.

Cheers,
Ben.

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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and
@ 2009-11-26  4:04     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:04 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:

>  
> -static int __init early_init_dt_scan_cpus(unsigned long node,
> -					  const char *uname, int depth,
> -					  void *data)
> +int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
> +				   int depth, void *data)
>  {

So now you make this one non-static as well with little hope of making
it static ever again

>  	static int logical_cpuid;
>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> @@ -113,8 +112,8 @@ void __init early_init_dt_scan_chosen_arch(unsigned long node)
>  	/* No Microblaze specific code here */
>  }
>  
> -static int __init early_init_dt_scan_memory(unsigned long node,
> -				const char *uname, int depth, void *data)
> +int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
> +				     int depth, void *data)
>  {

And this one

>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
>  	u32 *reg, *endp;
> @@ -201,7 +200,7 @@ static inline unsigned long phyp_dump_calculate_reserve_size(void)
>   * without reserving anything. The memory in case of dump being
>   * active is freed when the dump is collected (by userland tools).
>   */
> -static void __init phyp_dump_reserve_mem(void)
> +void __init phyp_dump_reserve_mem(void)
>  {

And this one...

>  /**
> + * early_init_move_devtree - move tree to an unused area, if needed.
> + *
> + * The device tree may be allocated beyond our memory limit, or inside the
> + * crash kernel region for kdump. If so, move it out of the way.
> + */
> +#if defined(CONFIG_PPC)
> +static void __init early_init_move_devtree(void)

And you still end up with an ifdef mess in the common code ...

Would it be possible instead to have one common early_init_devtree()
that calls into the "common" ones (which you can then make static again,
inside the common code) and then calls one arch_early_init_devtree()
which regroups the arch specific ones ?

Or there's too many ordering issues ?

Another option then is to call from that early_init_devtree() something
like:

	arch_early_init_dt_mem()
	arch_early_init_dt_cpu()
	arch_early_init_move_devtree()

etc... in the right spots in the common code and have the archs who
don't do anything there just have them as empty inlines.

Cheers,
Ben.


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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree()
@ 2009-11-26  4:04     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:04 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:

>  
> -static int __init early_init_dt_scan_cpus(unsigned long node,
> -					  const char *uname, int depth,
> -					  void *data)
> +int __init early_init_dt_scan_cpus(unsigned long node, const char *uname,
> +				   int depth, void *data)
>  {

So now you make this one non-static as well with little hope of making
it static ever again

>  	static int logical_cpuid;
>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> @@ -113,8 +112,8 @@ void __init early_init_dt_scan_chosen_arch(unsigned long node)
>  	/* No Microblaze specific code here */
>  }
>  
> -static int __init early_init_dt_scan_memory(unsigned long node,
> -				const char *uname, int depth, void *data)
> +int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
> +				     int depth, void *data)
>  {

And this one

>  	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
>  	u32 *reg, *endp;
> @@ -201,7 +200,7 @@ static inline unsigned long phyp_dump_calculate_reserve_size(void)
>   * without reserving anything. The memory in case of dump being
>   * active is freed when the dump is collected (by userland tools).
>   */
> -static void __init phyp_dump_reserve_mem(void)
> +void __init phyp_dump_reserve_mem(void)
>  {

And this one...

>  /**
> + * early_init_move_devtree - move tree to an unused area, if needed.
> + *
> + * The device tree may be allocated beyond our memory limit, or inside the
> + * crash kernel region for kdump. If so, move it out of the way.
> + */
> +#if defined(CONFIG_PPC)
> +static void __init early_init_move_devtree(void)

And you still end up with an ifdef mess in the common code ...

Would it be possible instead to have one common early_init_devtree()
that calls into the "common" ones (which you can then make static again,
inside the common code) and then calls one arch_early_init_devtree()
which regroups the arch specific ones ?

Or there's too many ordering issues ?

Another option then is to call from that early_init_devtree() something
like:

	arch_early_init_dt_mem()
	arch_early_init_dt_cpu()
	arch_early_init_move_devtree()

etc... in the right spots in the common code and have the archs who
don't do anything there just have them as empty inlines.

Cheers,
Ben.

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

* Re: [PATCH 07/11] of: merge machine_is_compatible()
  2009-11-24  8:19   ` Grant Likely
  (?)
@ 2009-11-26  4:05     ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:05 UTC (permalink / raw)
  To: Grant Likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze

I don't like moving this one to common code without the of_ prefix. I
think you should move it with the of_ prefix, and then add a alias in
powerpc and microblaze without of_ in a header until we fix all call
sites (which you can put on your to-do list :-)

Cheers,
Ben.

> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> 
>  arch/microblaze/kernel/prom.c |   18 ------------------
>  arch/powerpc/kernel/prom.c    |   18 ------------------
>  drivers/of/base.c             |   18 ++++++++++++++++++
>  3 files changed, 18 insertions(+), 36 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index 543465a..c97192d 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -281,24 +281,6 @@ void __init early_init_devtree_arch(void)
>  	/* No Microblaze specific code here */
>  }
>  
> -/**
> - * Indicates whether the root node has a given value in its
> - * compatible property.
> - */
> -int machine_is_compatible(const char *compat)
> -{
> -	struct device_node *root;
> -	int rc = 0;
> -
> -	root = of_find_node_by_path("/");
> -	if (root) {
> -		rc = of_device_is_compatible(root, compat);
> -		of_node_put(root);
> -	}
> -	return rc;
> -}
> -EXPORT_SYMBOL(machine_is_compatible);
> -
>  /*******
>   *
>   * New implementation of the OF "find" APIs, return a refcounted
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index a5b3b9d..65de093 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -677,24 +677,6 @@ void __init early_init_devtree_arch(void)
>  	lmb_enforce_memory_limit(limit);
>  }
>  
> -/**
> - * Indicates whether the root node has a given value in its
> - * compatible property.
> - */
> -int machine_is_compatible(const char *compat)
> -{
> -	struct device_node *root;
> -	int rc = 0;
> -
> -	root = of_find_node_by_path("/");
> -	if (root) {
> -		rc = of_device_is_compatible(root, compat);
> -		of_node_put(root);
> -	}
> -	return rc;
> -}
> -EXPORT_SYMBOL(machine_is_compatible);
> -
>  /*******
>   *
>   * New implementation of the OF "find" APIs, return a refcounted
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index ec56739..e81558f 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -144,6 +144,24 @@ int of_device_is_compatible(const struct device_node *device,
>  EXPORT_SYMBOL(of_device_is_compatible);
>  
>  /**
> + * Indicates whether the root node has a given value in its
> + * compatible property.
> + */
> +int machine_is_compatible(const char *compat)
> +{
> +	struct device_node *root;
> +	int rc = 0;
> +
> +	root = of_find_node_by_path("/");
> +	if (root) {
> +		rc = of_device_is_compatible(root, compat);
> +		of_node_put(root);
> +	}
> +	return rc;
> +}
> +EXPORT_SYMBOL(machine_is_compatible);
> +
> +/**
>   *  of_device_is_available - check if a device is available for use
>   *
>   *  @device: Node to check for availability



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

* Re: [PATCH 07/11] of: merge machine_is_compatible()
@ 2009-11-26  4:05     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:05 UTC (permalink / raw)
  To: Grant Likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze

I don't like moving this one to common code without the of_ prefix. I
think you should move it with the of_ prefix, and then add a alias in
powerpc and microblaze without of_ in a header until we fix all call
sites (which you can put on your to-do list :-)

Cheers,
Ben.

> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> 
>  arch/microblaze/kernel/prom.c |   18 ------------------
>  arch/powerpc/kernel/prom.c    |   18 ------------------
>  drivers/of/base.c             |   18 ++++++++++++++++++
>  3 files changed, 18 insertions(+), 36 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index 543465a..c97192d 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -281,24 +281,6 @@ void __init early_init_devtree_arch(void)
>  	/* No Microblaze specific code here */
>  }
>  
> -/**
> - * Indicates whether the root node has a given value in its
> - * compatible property.
> - */
> -int machine_is_compatible(const char *compat)
> -{
> -	struct device_node *root;
> -	int rc = 0;
> -
> -	root = of_find_node_by_path("/");
> -	if (root) {
> -		rc = of_device_is_compatible(root, compat);
> -		of_node_put(root);
> -	}
> -	return rc;
> -}
> -EXPORT_SYMBOL(machine_is_compatible);
> -
>  /*******
>   *
>   * New implementation of the OF "find" APIs, return a refcounted
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index a5b3b9d..65de093 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -677,24 +677,6 @@ void __init early_init_devtree_arch(void)
>  	lmb_enforce_memory_limit(limit);
>  }
>  
> -/**
> - * Indicates whether the root node has a given value in its
> - * compatible property.
> - */
> -int machine_is_compatible(const char *compat)
> -{
> -	struct device_node *root;
> -	int rc = 0;
> -
> -	root = of_find_node_by_path("/");
> -	if (root) {
> -		rc = of_device_is_compatible(root, compat);
> -		of_node_put(root);
> -	}
> -	return rc;
> -}
> -EXPORT_SYMBOL(machine_is_compatible);
> -
>  /*******
>   *
>   * New implementation of the OF "find" APIs, return a refcounted
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index ec56739..e81558f 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -144,6 +144,24 @@ int of_device_is_compatible(const struct device_node *device,
>  EXPORT_SYMBOL(of_device_is_compatible);
>  
>  /**
> + * Indicates whether the root node has a given value in its
> + * compatible property.
> + */
> +int machine_is_compatible(const char *compat)
> +{
> +	struct device_node *root;
> +	int rc = 0;
> +
> +	root = of_find_node_by_path("/");
> +	if (root) {
> +		rc = of_device_is_compatible(root, compat);
> +		of_node_put(root);
> +	}
> +	return rc;
> +}
> +EXPORT_SYMBOL(machine_is_compatible);
> +
> +/**
>   *  of_device_is_available - check if a device is available for use
>   *
>   *  @device: Node to check for availability



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

* Re: [PATCH 07/11] of: merge machine_is_compatible()
@ 2009-11-26  4:05     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:05 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze

I don't like moving this one to common code without the of_ prefix. I
think you should move it with the of_ prefix, and then add a alias in
powerpc and microblaze without of_ in a header until we fix all call
sites (which you can put on your to-do list :-)

Cheers,
Ben.

> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> 
>  arch/microblaze/kernel/prom.c |   18 ------------------
>  arch/powerpc/kernel/prom.c    |   18 ------------------
>  drivers/of/base.c             |   18 ++++++++++++++++++
>  3 files changed, 18 insertions(+), 36 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index 543465a..c97192d 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -281,24 +281,6 @@ void __init early_init_devtree_arch(void)
>  	/* No Microblaze specific code here */
>  }
>  
> -/**
> - * Indicates whether the root node has a given value in its
> - * compatible property.
> - */
> -int machine_is_compatible(const char *compat)
> -{
> -	struct device_node *root;
> -	int rc = 0;
> -
> -	root = of_find_node_by_path("/");
> -	if (root) {
> -		rc = of_device_is_compatible(root, compat);
> -		of_node_put(root);
> -	}
> -	return rc;
> -}
> -EXPORT_SYMBOL(machine_is_compatible);
> -
>  /*******
>   *
>   * New implementation of the OF "find" APIs, return a refcounted
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index a5b3b9d..65de093 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -677,24 +677,6 @@ void __init early_init_devtree_arch(void)
>  	lmb_enforce_memory_limit(limit);
>  }
>  
> -/**
> - * Indicates whether the root node has a given value in its
> - * compatible property.
> - */
> -int machine_is_compatible(const char *compat)
> -{
> -	struct device_node *root;
> -	int rc = 0;
> -
> -	root = of_find_node_by_path("/");
> -	if (root) {
> -		rc = of_device_is_compatible(root, compat);
> -		of_node_put(root);
> -	}
> -	return rc;
> -}
> -EXPORT_SYMBOL(machine_is_compatible);
> -
>  /*******
>   *
>   * New implementation of the OF "find" APIs, return a refcounted
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index ec56739..e81558f 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -144,6 +144,24 @@ int of_device_is_compatible(const struct device_node *device,
>  EXPORT_SYMBOL(of_device_is_compatible);
>  
>  /**
> + * Indicates whether the root node has a given value in its
> + * compatible property.
> + */
> +int machine_is_compatible(const char *compat)
> +{
> +	struct device_node *root;
> +	int rc = 0;
> +
> +	root = of_find_node_by_path("/");
> +	if (root) {
> +		rc = of_device_is_compatible(root, compat);
> +		of_node_put(root);
> +	}
> +	return rc;
> +}
> +EXPORT_SYMBOL(machine_is_compatible);
> +
> +/**
>   *  of_device_is_available - check if a device is available for use
>   *
>   *  @device: Node to check for availability

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
  2009-11-26  3:59     ` Benjamin Herrenschmidt
  (?)
@ 2009-11-26  4:05       ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-26  4:05 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Wed, Nov 25, 2009 at 8:59 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
>> A cell is firmly established as a u32.  No need to do an ugly typedef
>> to redefine it to cell_t.  Eliminate the unnecessary typedef so that
>> it doesn't have to be added to the of_fdt header file
>>
>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>> ---
>
> I'm not sure about that one. Yes, we do use u32 a lot and cell_t rarely,
> so it would seem logical to switch.... On the other hand, we have that
> pesky endianness issue we have never fully solved. So we need accessors
> to sort that out, which means directly tapping things as u32 * is not a
> good idea if we're going to enforce the use of such accessors.
>
> I believe we should probably just enforce that properties are big endian
> for flat device-trees. In which case we could just use __be32 or on of
> thoes sparse-friendly types. I know x86 people won't like that much and
> to be honest I don't know what 1295 specifies for real OFs but there
> aren't enough real OFs around on LE machines for us to care much about
> it, is there ?

Word from Mitch is the device tree is network byte order.  period.

> The reason I prefer a fixed endianness is that allowing "LE" trees
> becomes really nasty when a number is expressed using multiple cells.
> That brings the question as to whether the two cells need to be flipped
> as well or only the bytes within each cell. And that's the easy bit
> (probably flip the whole thing). What about something like a PCI "reg"
> property which is made of 3 cells, two of them forming a 64-bit address
> and one containing additional data & attributes ? What is flipped and
> where ?

exactly.

> So yes, cell_t might not be the right approach and by far to generic a
> name, but u32 isn't the answer neither.

You're right, it's not, but makes merging less complex, and then I can
refactor properly.

g.


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26  4:05       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-26  4:05 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Wed, Nov 25, 2009 at 8:59 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
>> A cell is firmly established as a u32.  No need to do an ugly typedef
>> to redefine it to cell_t.  Eliminate the unnecessary typedef so that
>> it doesn't have to be added to the of_fdt header file
>>
>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>> ---
>
> I'm not sure about that one. Yes, we do use u32 a lot and cell_t rarely,
> so it would seem logical to switch.... On the other hand, we have that
> pesky endianness issue we have never fully solved. So we need accessors
> to sort that out, which means directly tapping things as u32 * is not a
> good idea if we're going to enforce the use of such accessors.
>
> I believe we should probably just enforce that properties are big endian
> for flat device-trees. In which case we could just use __be32 or on of
> thoes sparse-friendly types. I know x86 people won't like that much and
> to be honest I don't know what 1295 specifies for real OFs but there
> aren't enough real OFs around on LE machines for us to care much about
> it, is there ?

Word from Mitch is the device tree is network byte order.  period.

> The reason I prefer a fixed endianness is that allowing "LE" trees
> becomes really nasty when a number is expressed using multiple cells.
> That brings the question as to whether the two cells need to be flipped
> as well or only the bytes within each cell. And that's the easy bit
> (probably flip the whole thing). What about something like a PCI "reg"
> property which is made of 3 cells, two of them forming a 64-bit address
> and one containing additional data & attributes ? What is flipped and
> where ?

exactly.

> So yes, cell_t might not be the right approach and by far to generic a
> name, but u32 isn't the answer neither.

You're right, it's not, but makes merging less complex, and then I can
refactor properly.

g.


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26  4:05       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-11-26  4:05 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Wed, Nov 25, 2009 at 8:59 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:18 -0700, Grant Likely wrote:
>> A cell is firmly established as a u32. =A0No need to do an ugly typedef
>> to redefine it to cell_t. =A0Eliminate the unnecessary typedef so that
>> it doesn't have to be added to the of_fdt header file
>>
>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>> ---
>
> I'm not sure about that one. Yes, we do use u32 a lot and cell_t rarely,
> so it would seem logical to switch.... On the other hand, we have that
> pesky endianness issue we have never fully solved. So we need accessors
> to sort that out, which means directly tapping things as u32 * is not a
> good idea if we're going to enforce the use of such accessors.
>
> I believe we should probably just enforce that properties are big endian
> for flat device-trees. In which case we could just use __be32 or on of
> thoes sparse-friendly types. I know x86 people won't like that much and
> to be honest I don't know what 1295 specifies for real OFs but there
> aren't enough real OFs around on LE machines for us to care much about
> it, is there ?

Word from Mitch is the device tree is network byte order.  period.

> The reason I prefer a fixed endianness is that allowing "LE" trees
> becomes really nasty when a number is expressed using multiple cells.
> That brings the question as to whether the two cells need to be flipped
> as well or only the bytes within each cell. And that's the easy bit
> (probably flip the whole thing). What about something like a PCI "reg"
> property which is made of 3 cells, two of them forming a 64-bit address
> and one containing additional data & attributes ? What is flipped and
> where ?

exactly.

> So yes, cell_t might not be the right approach and by far to generic a
> name, but u32 isn't the answer neither.

You're right, it's not, but makes merging less complex, and then I can
refactor properly.

g.


--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 08/11] of: Merge of_node_get() and of_node_put()
  2009-11-24  8:19   ` Grant Likely
  (?)
@ 2009-11-26  4:06     ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:06 UTC (permalink / raw)
  To: Grant Likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:

>  
> +#if !defined(CONFIG_SPARC)   /* SPARC doesn't do ref counting (yet) */
> +/**

Make this a Kconfig symbol, something like CONFIG_OF_DYNAMIC. You need
refcounting when you can add/remove nodes dynamically. Some embedded
archs might want the option to not enable that and save space.

Cheers,
Ben.



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

* Re: [PATCH 08/11] of: Merge of_node_get() and of_node_put()
@ 2009-11-26  4:06     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:06 UTC (permalink / raw)
  To: Grant Likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:

>  
> +#if !defined(CONFIG_SPARC)   /* SPARC doesn't do ref counting (yet) */
> +/**

Make this a Kconfig symbol, something like CONFIG_OF_DYNAMIC. You need
refcounting when you can add/remove nodes dynamically. Some embedded
archs might want the option to not enable that and save space.

Cheers,
Ben.



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

* Re: [PATCH 08/11] of: Merge of_node_get() and of_node_put()
@ 2009-11-26  4:06     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:06 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:

>  
> +#if !defined(CONFIG_SPARC)   /* SPARC doesn't do ref counting (yet) */
> +/**

Make this a Kconfig symbol, something like CONFIG_OF_DYNAMIC. You need
refcounting when you can add/remove nodes dynamically. Some embedded
archs might want the option to not enable that and save space.

Cheers,
Ben.

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

* Re: [PATCH 09/11] of: merge of_attach_node() & of_detach_node()
  2009-11-24  8:19   ` Grant Likely
  (?)
@ 2009-11-26  4:07     ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:07 UTC (permalink / raw)
  To: Grant Likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze

Some of those guys might wnat to be in of_dynamic (see previous email)

Remember: We want to keep the footprint low for embedded archs that
don't want to do dynamic stuff. Really low.

Cheers,
Ben.

> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> 
>  arch/microblaze/include/asm/prom.h |    4 --
>  arch/microblaze/kernel/prom.c      |   59 -----------------------------------
>  arch/powerpc/include/asm/prom.h    |    4 --
>  arch/powerpc/kernel/prom.c         |   59 -----------------------------------
>  drivers/of/base.c                  |   60 ++++++++++++++++++++++++++++++++++++
>  include/linux/of.h                 |    4 ++
>  6 files changed, 64 insertions(+), 126 deletions(-)
> 
> diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
> index 07d1063..6c6b386 100644
> --- a/arch/microblaze/include/asm/prom.h
> +++ b/arch/microblaze/include/asm/prom.h
> @@ -39,10 +39,6 @@ extern struct device_node *of_chosen;
>  
>  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);
>  
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index c0d53b7..8c00457 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -313,65 +313,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
>  }
>  EXPORT_SYMBOL(of_find_node_by_phandle);
>  
> -/*
> - * 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.
> - */
> -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;
>  
> diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
> index 2ab9cbd..f384db8 100644
> --- a/arch/powerpc/include/asm/prom.h
> +++ b/arch/powerpc/include/asm/prom.h
> @@ -34,10 +34,6 @@ extern struct device_node *of_chosen;
>  
>  #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
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 6873db9..7d0beeb 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -740,65 +740,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
>  	return NULL;
>  }
>  
> -/*
> - * 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.
> - */
> -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:
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 4b10c89..9212b87 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -60,6 +60,66 @@ int of_n_size_cells(struct device_node *np)
>  }
>  EXPORT_SYMBOL(of_n_size_cells);
>  
> +/**
> + * of_attach_node - 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);
> +}
> +
> +/**
> + * of_detach_node - "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_SPARC)   /* SPARC doesn't do ref counting (yet) */
>  /**
>   *	of_node_get - Increment refcount of a node
> diff --git a/include/linux/of.h b/include/linux/of.h
> index d4c014a..0a51742 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -130,6 +130,10 @@ static inline unsigned long of_read_ulong(const u32 *cell, int size)
>  
>  #define OF_BAD_ADDR	((u64)-1)
>  
> +/* For updating the device tree at runtime */
> +extern void of_attach_node(struct device_node *);
> +extern void of_detach_node(struct device_node *);
> +
>  extern struct device_node *of_find_node_by_name(struct device_node *from,
>  	const char *name);
>  #define for_each_node_by_name(dn, name) \



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

* Re: [PATCH 09/11] of: merge of_attach_node() & of_detach_node()
@ 2009-11-26  4:07     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:07 UTC (permalink / raw)
  To: Grant Likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze

Some of those guys might wnat to be in of_dynamic (see previous email)

Remember: We want to keep the footprint low for embedded archs that
don't want to do dynamic stuff. Really low.

Cheers,
Ben.

> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> 
>  arch/microblaze/include/asm/prom.h |    4 --
>  arch/microblaze/kernel/prom.c      |   59 -----------------------------------
>  arch/powerpc/include/asm/prom.h    |    4 --
>  arch/powerpc/kernel/prom.c         |   59 -----------------------------------
>  drivers/of/base.c                  |   60 ++++++++++++++++++++++++++++++++++++
>  include/linux/of.h                 |    4 ++
>  6 files changed, 64 insertions(+), 126 deletions(-)
> 
> diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
> index 07d1063..6c6b386 100644
> --- a/arch/microblaze/include/asm/prom.h
> +++ b/arch/microblaze/include/asm/prom.h
> @@ -39,10 +39,6 @@ extern struct device_node *of_chosen;
>  
>  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);
>  
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index c0d53b7..8c00457 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -313,65 +313,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
>  }
>  EXPORT_SYMBOL(of_find_node_by_phandle);
>  
> -/*
> - * 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.
> - */
> -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;
>  
> diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
> index 2ab9cbd..f384db8 100644
> --- a/arch/powerpc/include/asm/prom.h
> +++ b/arch/powerpc/include/asm/prom.h
> @@ -34,10 +34,6 @@ extern struct device_node *of_chosen;
>  
>  #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
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 6873db9..7d0beeb 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -740,65 +740,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
>  	return NULL;
>  }
>  
> -/*
> - * 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.
> - */
> -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:
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 4b10c89..9212b87 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -60,6 +60,66 @@ int of_n_size_cells(struct device_node *np)
>  }
>  EXPORT_SYMBOL(of_n_size_cells);
>  
> +/**
> + * of_attach_node - 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);
> +}
> +
> +/**
> + * of_detach_node - "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_SPARC)   /* SPARC doesn't do ref counting (yet) */
>  /**
>   *	of_node_get - Increment refcount of a node
> diff --git a/include/linux/of.h b/include/linux/of.h
> index d4c014a..0a51742 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -130,6 +130,10 @@ static inline unsigned long of_read_ulong(const u32 *cell, int size)
>  
>  #define OF_BAD_ADDR	((u64)-1)
>  
> +/* For updating the device tree at runtime */
> +extern void of_attach_node(struct device_node *);
> +extern void of_detach_node(struct device_node *);
> +
>  extern struct device_node *of_find_node_by_name(struct device_node *from,
>  	const char *name);
>  #define for_each_node_by_name(dn, name) \



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

* Re: [PATCH 09/11] of: merge of_attach_node() & of_detach_node()
@ 2009-11-26  4:07     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:07 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
> Merge common code between PowerPC and Microblaze

Some of those guys might wnat to be in of_dynamic (see previous email)

Remember: We want to keep the footprint low for embedded archs that
don't want to do dynamic stuff. Really low.

Cheers,
Ben.

> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> 
>  arch/microblaze/include/asm/prom.h |    4 --
>  arch/microblaze/kernel/prom.c      |   59 -----------------------------------
>  arch/powerpc/include/asm/prom.h    |    4 --
>  arch/powerpc/kernel/prom.c         |   59 -----------------------------------
>  drivers/of/base.c                  |   60 ++++++++++++++++++++++++++++++++++++
>  include/linux/of.h                 |    4 ++
>  6 files changed, 64 insertions(+), 126 deletions(-)
> 
> diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
> index 07d1063..6c6b386 100644
> --- a/arch/microblaze/include/asm/prom.h
> +++ b/arch/microblaze/include/asm/prom.h
> @@ -39,10 +39,6 @@ extern struct device_node *of_chosen;
>  
>  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);
>  
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index c0d53b7..8c00457 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -313,65 +313,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
>  }
>  EXPORT_SYMBOL(of_find_node_by_phandle);
>  
> -/*
> - * 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.
> - */
> -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;
>  
> diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
> index 2ab9cbd..f384db8 100644
> --- a/arch/powerpc/include/asm/prom.h
> +++ b/arch/powerpc/include/asm/prom.h
> @@ -34,10 +34,6 @@ extern struct device_node *of_chosen;
>  
>  #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
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 6873db9..7d0beeb 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -740,65 +740,6 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
>  	return NULL;
>  }
>  
> -/*
> - * 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.
> - */
> -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:
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 4b10c89..9212b87 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -60,6 +60,66 @@ int of_n_size_cells(struct device_node *np)
>  }
>  EXPORT_SYMBOL(of_n_size_cells);
>  
> +/**
> + * of_attach_node - 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);
> +}
> +
> +/**
> + * of_detach_node - "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_SPARC)   /* SPARC doesn't do ref counting (yet) */
>  /**
>   *	of_node_get - Increment refcount of a node
> diff --git a/include/linux/of.h b/include/linux/of.h
> index d4c014a..0a51742 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -130,6 +130,10 @@ static inline unsigned long of_read_ulong(const u32 *cell, int size)
>  
>  #define OF_BAD_ADDR	((u64)-1)
>  
> +/* For updating the device tree at runtime */
> +extern void of_attach_node(struct device_node *);
> +extern void of_detach_node(struct device_node *);
> +
>  extern struct device_node *of_find_node_by_name(struct device_node *from,
>  	const char *name);
>  #define for_each_node_by_name(dn, name) \

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
  2009-11-26  4:05       ` Grant Likely
@ 2009-11-26  5:27         ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:27 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Wed, 2009-11-25 at 21:05 -0700, Grant Likely wrote:
> 
> You're right, it's not, but makes merging less complex, and then I can
> refactor properly. 

Still, make them __be32 at least

Cheers,
Ben.

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26  5:27         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:27 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Wed, 2009-11-25 at 21:05 -0700, Grant Likely wrote:
> 
> You're right, it's not, but makes merging less complex, and then I can
> refactor properly. 

Still, make them __be32 at least

Cheers,
Ben.


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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
       [not found]       ` <fa686aa40911252005o2db85dfk3d9acc61c12ca5e5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2009-11-26  6:28           ` M. Warner Losh
@ 2009-11-26  6:28           ` M. Warner Losh
  0 siblings, 0 replies; 123+ messages in thread
From: M. Warner Losh @ 2009-11-26  6:28 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

In message: <fa686aa40911252005o2db85dfk3d9acc61c12ca5e5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
            Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> writes:
: Word from Mitch is the device tree is network byte order.  period.

OpenFirmware defines the order to be big endian always, even on little
endian processors.

Warner

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26  6:28           ` M. Warner Losh
  0 siblings, 0 replies; 123+ messages in thread
From: M. Warner Losh @ 2009-11-26  6:28 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

In message: <fa686aa40911252005o2db85dfk3d9acc61c12ca5e5@mail.gmail.com>
            Grant Likely <grant.likely@secretlab.ca> writes:
: Word from Mitch is the device tree is network byte order.  period.

OpenFirmware defines the order to be big endian always, even on little
endian processors.

Warner

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26  6:28           ` M. Warner Losh
  0 siblings, 0 replies; 123+ messages in thread
From: M. Warner Losh @ 2009-11-26  6:28 UTC (permalink / raw)
  To: grant.likely
  Cc: sfr, devicetree-discuss, microblaze-uclinux, sparclinux,
	linuxppc-dev, davem

In message: <fa686aa40911252005o2db85dfk3d9acc61c12ca5e5@mail.gmail.com>
            Grant Likely <grant.likely@secretlab.ca> writes:
: Word from Mitch is the device tree is network byte order.  period.

OpenFirmware defines the order to be big endian always, even on little
endian processors.

Warner

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
       [not found]           ` <20091125.232818.-1350498258.imp-uzTCJ5RojNnQT0dZR+AlfA@public.gmane.org>
  2009-11-26  7:06               ` Benjamin Herrenschmidt
@ 2009-11-26  7:06               ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  7:06 UTC (permalink / raw)
  To: M. Warner Losh
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Wed, 2009-11-25 at 23:28 -0700, M. Warner Losh wrote:
> In message:
> <fa686aa40911252005o2db85dfk3d9acc61c12ca5e5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
>             Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> writes:
> : Word from Mitch is the device tree is network byte order.  period.
> 
> OpenFirmware defines the order to be big endian always, even on little
> endian processors.

Right, that's the only sane way to do it, I just didn't remember off
hand what was said in the OF spec :-)

Cheers,
Ben.

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26  7:06               ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  7:06 UTC (permalink / raw)
  To: M. Warner Losh
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Wed, 2009-11-25 at 23:28 -0700, M. Warner Losh wrote:
> In message:
> <fa686aa40911252005o2db85dfk3d9acc61c12ca5e5@mail.gmail.com>
>             Grant Likely <grant.likely@secretlab.ca> writes:
> : Word from Mitch is the device tree is network byte order.  period.
> 
> OpenFirmware defines the order to be big endian always, even on little
> endian processors.

Right, that's the only sane way to do it, I just didn't remember off
hand what was said in the OF spec :-)

Cheers,
Ben.



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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26  7:06               ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  7:06 UTC (permalink / raw)
  To: M. Warner Losh
  Cc: sfr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Wed, 2009-11-25 at 23:28 -0700, M. Warner Losh wrote:
> In message:
> <fa686aa40911252005o2db85dfk3d9acc61c12ca5e5@mail.gmail.com>
>             Grant Likely <grant.likely@secretlab.ca> writes:
> : Word from Mitch is the device tree is network byte order.  period.
> 
> OpenFirmware defines the order to be big endian always, even on little
> endian processors.

Right, that's the only sane way to do it, I just didn't remember off
hand what was said in the OF spec :-)

Cheers,
Ben.

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
  2009-11-26  7:06               ` Benjamin Herrenschmidt
  (?)
@ 2009-11-26  7:52                 ` Mitch Bradley
  -1 siblings, 0 replies; 123+ messages in thread
From: Mitch Bradley @ 2009-11-26  7:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

>
> Right, that's the only sane way to do it, I just didn't remember off
> hand what was said in the OF spec  :-) 


3.2.2.1.2 Property values

The property-encoding format is independent of hardware byte order and 
alignment characteristics.  The encoded byte order is well-defined (in 
particular, it is big endian). ...

...

-- 32-bit integer.  A 32-bit integer is encoded into a property value 
byte array by storing the most significant byte at the next available 
address, followed (at address+1) by the high middle byte, the low middle 
byte, and (at address+3) the least significant byte.

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26  7:52                 ` Mitch Bradley
  0 siblings, 0 replies; 123+ messages in thread
From: Mitch Bradley @ 2009-11-26  7:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

>
> Right, that's the only sane way to do it, I just didn't remember off
> hand what was said in the OF spec  :-) 


3.2.2.1.2 Property values

The property-encoding format is independent of hardware byte order and 
alignment characteristics.  The encoded byte order is well-defined (in 
particular, it is big endian). ...

...

-- 32-bit integer.  A 32-bit integer is encoded into a property value 
byte array by storing the most significant byte at the next available 
address, followed (at address+1) by the high middle byte, the low middle 
byte, and (at address+3) the least significant byte.


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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26  7:52                 ` Mitch Bradley
  0 siblings, 0 replies; 123+ messages in thread
From: Mitch Bradley @ 2009-11-26  7:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem, M. Warner Losh

>
> Right, that's the only sane way to do it, I just didn't remember off
> hand what was said in the OF spec  :-) 


3.2.2.1.2 Property values

The property-encoding format is independent of hardware byte order and 
alignment characteristics.  The encoded byte order is well-defined (in 
particular, it is big endian). ...

...

-- 32-bit integer.  A 32-bit integer is encoded into a property value 
byte array by storing the most significant byte at the next available 
address, followed (at address+1) by the high middle byte, the low middle 
byte, and (at address+3) the least significant byte.

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

* Re: [PATCH 00/11] Yet another series of OF merge patches.
  2009-11-24  8:17 ` Grant Likely
  (?)
@ 2009-11-26 12:28   ` Wolfram Sang
  -1 siblings, 0 replies; 123+ messages in thread
From: Wolfram Sang @ 2009-11-26 12:28 UTC (permalink / raw)
  To: Grant Likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

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

On Tue, Nov 24, 2009 at 01:17:41AM -0700, Grant Likely wrote:
> Nothing much to say here other than mostly mechanical merging of OF
> support code.  Some of it remains a little ugly, but I'm taking the
> approach of merging the code first, and refactoring it second.
> 
> I've pushed this series out to my test-devicetree branch on my git
> server if anyone wants to test.  That branch also includes the
> previous 2 patch series that I've sent out.
> 
> git://git.secretlab.ca/git/linux-2.6 test-devicetree
> 
> Compile tested on: ppc64, ppc32, microblaze, sparc64, sparc32.
> Boot tested on mpc5200 (ppc32) platform.

test-devicetree as of today also works fine on my phyCORE-MPC5200B-IO.

Tested-by: Wolfram Sang <w.sang@pengutronix.de>

-- 
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] 123+ messages in thread

* Re: [PATCH 00/11] Yet another series of OF merge patches.
@ 2009-11-26 12:28   ` Wolfram Sang
  0 siblings, 0 replies; 123+ messages in thread
From: Wolfram Sang @ 2009-11-26 12:28 UTC (permalink / raw)
  To: Grant Likely
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

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

On Tue, Nov 24, 2009 at 01:17:41AM -0700, Grant Likely wrote:
> Nothing much to say here other than mostly mechanical merging of OF
> support code.  Some of it remains a little ugly, but I'm taking the
> approach of merging the code first, and refactoring it second.
> 
> I've pushed this series out to my test-devicetree branch on my git
> server if anyone wants to test.  That branch also includes the
> previous 2 patch series that I've sent out.
> 
> git://git.secretlab.ca/git/linux-2.6 test-devicetree
> 
> Compile tested on: ppc64, ppc32, microblaze, sparc64, sparc32.
> Boot tested on mpc5200 (ppc32) platform.

test-devicetree as of today also works fine on my phyCORE-MPC5200B-IO.

Tested-by: Wolfram Sang <w.sang@pengutronix.de>

-- 
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] 123+ messages in thread

* Re: [PATCH 00/11] Yet another series of OF merge patches.
@ 2009-11-26 12:28   ` Wolfram Sang
  0 siblings, 0 replies; 123+ messages in thread
From: Wolfram Sang @ 2009-11-26 12:28 UTC (permalink / raw)
  To: Grant Likely
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

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

On Tue, Nov 24, 2009 at 01:17:41AM -0700, Grant Likely wrote:
> Nothing much to say here other than mostly mechanical merging of OF
> support code.  Some of it remains a little ugly, but I'm taking the
> approach of merging the code first, and refactoring it second.
> 
> I've pushed this series out to my test-devicetree branch on my git
> server if anyone wants to test.  That branch also includes the
> previous 2 patch series that I've sent out.
> 
> git://git.secretlab.ca/git/linux-2.6 test-devicetree
> 
> Compile tested on: ppc64, ppc32, microblaze, sparc64, sparc32.
> Boot tested on mpc5200 (ppc32) platform.

test-devicetree as of today also works fine on my phyCORE-MPC5200B-IO.

Tested-by: Wolfram Sang <w.sang@pengutronix.de>

-- 
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] 123+ messages in thread

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
  2009-11-26  5:27         ` Benjamin Herrenschmidt
  (?)
@ 2009-11-26 21:36           ` Segher Boessenkool
  -1 siblings, 0 replies; 123+ messages in thread
From: Segher Boessenkool @ 2009-11-26 21:36 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Grant Likely, sfr, microblaze-uclinux, devicetree-discuss,
	sparclinux, linuxppc-dev, davem

>> You're right, it's not, but makes merging less complex, and then I  
>> can
>> refactor properly.
>
> Still, make them __be32 at least

There is no alignment guarantee at all either, better make it all u8
and use accessor functions everywhere.


Segher


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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26 21:36           ` Segher Boessenkool
  0 siblings, 0 replies; 123+ messages in thread
From: Segher Boessenkool @ 2009-11-26 21:36 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Grant Likely, sfr, microblaze-uclinux, devicetree-discuss,
	sparclinux, linuxppc-dev, davem

>> You're right, it's not, but makes merging less complex, and then I  
>> can
>> refactor properly.
>
> Still, make them __be32 at least

There is no alignment guarantee at all either, better make it all u8
and use accessor functions everywhere.


Segher


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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26 21:36           ` Segher Boessenkool
  0 siblings, 0 replies; 123+ messages in thread
From: Segher Boessenkool @ 2009-11-26 21:36 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

>> You're right, it's not, but makes merging less complex, and then I  
>> can
>> refactor properly.
>
> Still, make them __be32 at least

There is no alignment guarantee at all either, better make it all u8
and use accessor functions everywhere.


Segher

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
  2009-11-26 21:36           ` Segher Boessenkool
  (?)
@ 2009-11-26 21:40             ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 21:40 UTC (permalink / raw)
  To: Segher Boessenkool
  Cc: Grant Likely, sfr, microblaze-uclinux, devicetree-discuss,
	sparclinux, linuxppc-dev, davem

On Thu, 2009-11-26 at 22:36 +0100, Segher Boessenkool wrote:
> >> You're right, it's not, but makes merging less complex, and then I  
> >> can
> >> refactor properly.
> >
> > Still, make them __be32 at least
> 
> There is no alignment guarantee at all either, better make it all u8
> and use accessor functions everywhere.

Well... if you want to force using an accessor, then make it an opaque
type. But __be32 is fine. It doesn't necessarily convey alignment and
besides, there happens to -be- aligned in almost all cases so far :-)
The flat tree format guarantees 32-bit alignment for the start of a
property, so we are good here I think.

Cheers,
Ben.



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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26 21:40             ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 21:40 UTC (permalink / raw)
  To: Segher Boessenkool
  Cc: Grant Likely, sfr, microblaze-uclinux, devicetree-discuss,
	sparclinux, linuxppc-dev, davem

On Thu, 2009-11-26 at 22:36 +0100, Segher Boessenkool wrote:
> >> You're right, it's not, but makes merging less complex, and then I  
> >> can
> >> refactor properly.
> >
> > Still, make them __be32 at least
> 
> There is no alignment guarantee at all either, better make it all u8
> and use accessor functions everywhere.

Well... if you want to force using an accessor, then make it an opaque
type. But __be32 is fine. It doesn't necessarily convey alignment and
besides, there happens to -be- aligned in almost all cases so far :-)
The flat tree format guarantees 32-bit alignment for the start of a
property, so we are good here I think.

Cheers,
Ben.



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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26 21:40             ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 123+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 21:40 UTC (permalink / raw)
  To: Segher Boessenkool
  Cc: sfr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Thu, 2009-11-26 at 22:36 +0100, Segher Boessenkool wrote:
> >> You're right, it's not, but makes merging less complex, and then I  
> >> can
> >> refactor properly.
> >
> > Still, make them __be32 at least
> 
> There is no alignment guarantee at all either, better make it all u8
> and use accessor functions everywhere.

Well... if you want to force using an accessor, then make it an opaque
type. But __be32 is fine. It doesn't necessarily convey alignment and
besides, there happens to -be- aligned in almost all cases so far :-)
The flat tree format guarantees 32-bit alignment for the start of a
property, so we are good here I think.

Cheers,
Ben.

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
  2009-11-26 21:36           ` Segher Boessenkool
  (?)
@ 2009-11-26 23:32             ` David Miller
  -1 siblings, 0 replies; 123+ messages in thread
From: David Miller @ 2009-11-26 23:32 UTC (permalink / raw)
  To: segher
  Cc: benh, grant.likely, sfr, microblaze-uclinux, devicetree-discuss,
	sparclinux, linuxppc-dev

From: Segher Boessenkool <segher@kernel.crashing.org>
Date: Thu, 26 Nov 2009 22:36:41 +0100

>>> You're right, it's not, but makes merging less complex, and then I can
>>> refactor properly.
>>
>> Still, make them __be32 at least
> 
> There is no alignment guarantee at all either, better make it all u8
> and use accessor functions everywhere.

I think that might be overkill.

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26 23:32             ` David Miller
  0 siblings, 0 replies; 123+ messages in thread
From: David Miller @ 2009-11-26 23:32 UTC (permalink / raw)
  To: segher
  Cc: benh, grant.likely, sfr, microblaze-uclinux, devicetree-discuss,
	sparclinux, linuxppc-dev

From: Segher Boessenkool <segher@kernel.crashing.org>
Date: Thu, 26 Nov 2009 22:36:41 +0100

>>> You're right, it's not, but makes merging less complex, and then I can
>>> refactor properly.
>>
>> Still, make them __be32 at least
> 
> There is no alignment guarantee at all either, better make it all u8
> and use accessor functions everywhere.

I think that might be overkill.

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-11-26 23:32             ` David Miller
  0 siblings, 0 replies; 123+ messages in thread
From: David Miller @ 2009-11-26 23:32 UTC (permalink / raw)
  To: segher
  Cc: sfr, devicetree-discuss, microblaze-uclinux, sparclinux, linuxppc-dev

From: Segher Boessenkool <segher@kernel.crashing.org>
Date: Thu, 26 Nov 2009 22:36:41 +0100

>>> You're right, it's not, but makes merging less complex, and then I can
>>> refactor properly.
>>
>> Still, make them __be32 at least
> 
> There is no alignment guarantee at all either, better make it all u8
> and use accessor functions everywhere.

I think that might be overkill.

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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree()
  2009-11-24  8:19   ` [PATCH 06/11] of/flattree: merge early_init_devtree() and Grant Likely
  (?)
@ 2009-12-07  7:08     ` Jeremy Kerr
  -1 siblings, 0 replies; 123+ messages in thread
From: Jeremy Kerr @ 2009-12-07  7:08 UTC (permalink / raw)
  To: devicetree-discuss
  Cc: Grant Likely, linuxppc-dev, sparclinux, microblaze-uclinux, benh,
	sfr, davem, monstr

Hi Grant,

> +	/* Scan memory nodes and rebuild LMBs */
> +	lmb_init();
> +	of_scan_flat_dt(early_init_dt_scan_root, NULL);
> +	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
> +
> +	/* Save command line for /proc/cmdline and then parse parameters */
> +	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
> +	parse_early_param();
> +
> +	/* This is in an arbitrary spot, but it is temporary.  After all
> +	 * the common code is merged, the structure of the early init
> +	 * code will be reevaluated and refactored */
> +	early_init_devtree_arch();
> +
> +	lmb_analyze();
> +	lmb_dump_all();

So we're assuming that the arch has lmb support, or should we make this 
conditional on CONFIG_HAVE_LMB?

Looks like ARM has its own lmb implementation (struct membank), so for the 
former case, I'd need to convert that to use lmb instead (which may not be a 
bad thing overall...)

Cheers,


Jeremy 

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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree()
@ 2009-12-07  7:08     ` Jeremy Kerr
  0 siblings, 0 replies; 123+ messages in thread
From: Jeremy Kerr @ 2009-12-07  7:08 UTC (permalink / raw)
  To: devicetree-discuss
  Cc: Grant Likely, linuxppc-dev, sparclinux, microblaze-uclinux, benh,
	sfr, davem, monstr

Hi Grant,

> +	/* Scan memory nodes and rebuild LMBs */
> +	lmb_init();
> +	of_scan_flat_dt(early_init_dt_scan_root, NULL);
> +	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
> +
> +	/* Save command line for /proc/cmdline and then parse parameters */
> +	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
> +	parse_early_param();
> +
> +	/* This is in an arbitrary spot, but it is temporary.  After all
> +	 * the common code is merged, the structure of the early init
> +	 * code will be reevaluated and refactored */
> +	early_init_devtree_arch();
> +
> +	lmb_analyze();
> +	lmb_dump_all();

So we're assuming that the arch has lmb support, or should we make this 
conditional on CONFIG_HAVE_LMB?

Looks like ARM has its own lmb implementation (struct membank), so for the 
former case, I'd need to convert that to use lmb instead (which may not be a 
bad thing overall...)

Cheers,


Jeremy 

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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree()
@ 2009-12-07  7:08     ` Jeremy Kerr
  0 siblings, 0 replies; 123+ messages in thread
From: Jeremy Kerr @ 2009-12-07  7:08 UTC (permalink / raw)
  To: devicetree-discuss
  Cc: sfr, monstr, microblaze-uclinux, sparclinux, linuxppc-dev, davem

Hi Grant,

> +	/* Scan memory nodes and rebuild LMBs */
> +	lmb_init();
> +	of_scan_flat_dt(early_init_dt_scan_root, NULL);
> +	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
> +
> +	/* Save command line for /proc/cmdline and then parse parameters */
> +	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
> +	parse_early_param();
> +
> +	/* This is in an arbitrary spot, but it is temporary.  After all
> +	 * the common code is merged, the structure of the early init
> +	 * code will be reevaluated and refactored */
> +	early_init_devtree_arch();
> +
> +	lmb_analyze();
> +	lmb_dump_all();

So we're assuming that the arch has lmb support, or should we make this 
conditional on CONFIG_HAVE_LMB?

Looks like ARM has its own lmb implementation (struct membank), so for the 
former case, I'd need to convert that to use lmb instead (which may not be a 
bad thing overall...)

Cheers,


Jeremy 

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

* Re: [PATCH 09/11] of: merge of_attach_node() & of_detach_node()
  2009-11-26  4:07     ` Benjamin Herrenschmidt
  (?)
@ 2009-12-10 22:21       ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-10 22:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Wed, Nov 25, 2009 at 9:07 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>
> Some of those guys might wnat to be in of_dynamic (see previous email)
>
> Remember: We want to keep the footprint low for embedded archs that
> don't want to do dynamic stuff. Really low.

I agree.  If it is okay by you I'll update this in a subsequent patch.
 Once the code is merge, then I'm going to do a bunch of refactoring
patches.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 09/11] of: merge of_attach_node() & of_detach_node()
@ 2009-12-10 22:21       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-10 22:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Wed, Nov 25, 2009 at 9:07 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>
> Some of those guys might wnat to be in of_dynamic (see previous email)
>
> Remember: We want to keep the footprint low for embedded archs that
> don't want to do dynamic stuff. Really low.

I agree.  If it is okay by you I'll update this in a subsequent patch.
 Once the code is merge, then I'm going to do a bunch of refactoring
patches.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 09/11] of: merge of_attach_node() & of_detach_node()
@ 2009-12-10 22:21       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-10 22:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Wed, Nov 25, 2009 at 9:07 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>
> Some of those guys might wnat to be in of_dynamic (see previous email)
>
> Remember: We want to keep the footprint low for embedded archs that
> don't want to do dynamic stuff. Really low.

I agree.  If it is okay by you I'll update this in a subsequent patch.
 Once the code is merge, then I'm going to do a bunch of refactoring
patches.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree()
  2009-11-26  4:04     ` [PATCH 06/11] of/flattree: merge early_init_devtree() and Benjamin Herrenschmidt
  (?)
@ 2009-12-11  6:19       ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:19 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Wed, Nov 25, 2009 at 9:04 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
>>  /**
>> + * early_init_move_devtree - move tree to an unused area, if needed.
>> + *
>> + * The device tree may be allocated beyond our memory limit, or inside the
>> + * crash kernel region for kdump. If so, move it out of the way.
>> + */
>> +#if defined(CONFIG_PPC)
>> +static void __init early_init_move_devtree(void)
>
> And you still end up with an ifdef mess in the common code ...

The #ifdefs are temporary.  I'm leaving them in now exactly because
they are ugly and show where the code needs to be refactored and
reorganized.  Once everything is merged, I'll probably do exactly what
you suggest.  I just cannot yet tell the exact structure of it until I
see the merged version.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and
@ 2009-12-11  6:19       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:19 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Wed, Nov 25, 2009 at 9:04 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
>>  /**
>> + * early_init_move_devtree - move tree to an unused area, if needed.
>> + *
>> + * The device tree may be allocated beyond our memory limit, or inside the
>> + * crash kernel region for kdump. If so, move it out of the way.
>> + */
>> +#if defined(CONFIG_PPC)
>> +static void __init early_init_move_devtree(void)
>
> And you still end up with an ifdef mess in the common code ...

The #ifdefs are temporary.  I'm leaving them in now exactly because
they are ugly and show where the code needs to be refactored and
reorganized.  Once everything is merged, I'll probably do exactly what
you suggest.  I just cannot yet tell the exact structure of it until I
see the merged version.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree()
@ 2009-12-11  6:19       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:19 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Wed, Nov 25, 2009 at 9:04 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
>> =A0/**
>> + * early_init_move_devtree - move tree to an unused area, if needed.
>> + *
>> + * The device tree may be allocated beyond our memory limit, or inside =
the
>> + * crash kernel region for kdump. If so, move it out of the way.
>> + */
>> +#if defined(CONFIG_PPC)
>> +static void __init early_init_move_devtree(void)
>
> And you still end up with an ifdef mess in the common code ...

The #ifdefs are temporary.  I'm leaving them in now exactly because
they are ugly and show where the code needs to be refactored and
reorganized.  Once everything is merged, I'll probably do exactly what
you suggest.  I just cannot yet tell the exact structure of it until I
see the merged version.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree()
  2009-12-07  7:08     ` Jeremy Kerr
  (?)
@ 2009-12-11  6:20       ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:20 UTC (permalink / raw)
  To: Jeremy Kerr
  Cc: devicetree-discuss, linuxppc-dev, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

On Mon, Dec 7, 2009 at 12:08 AM, Jeremy Kerr <jeremy.kerr@canonical.com> wrote:
> Hi Grant,
>
>> +     /* Scan memory nodes and rebuild LMBs */
>> +     lmb_init();
>> +     of_scan_flat_dt(early_init_dt_scan_root, NULL);
>> +     of_scan_flat_dt(early_init_dt_scan_memory, NULL);
>> +
>> +     /* Save command line for /proc/cmdline and then parse parameters */
>> +     strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
>> +     parse_early_param();
>> +
>> +     /* This is in an arbitrary spot, but it is temporary.  After all
>> +      * the common code is merged, the structure of the early init
>> +      * code will be reevaluated and refactored */
>> +     early_init_devtree_arch();
>> +
>> +     lmb_analyze();
>> +     lmb_dump_all();
>
> So we're assuming that the arch has lmb support, or should we make this
> conditional on CONFIG_HAVE_LMB?

I'm not making any assumptions yet.  I'm just merging the code.  A lot
of it needs to be refactored after the merge.  Feel free to send
patches to rework want you need.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and
@ 2009-12-11  6:20       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:20 UTC (permalink / raw)
  To: Jeremy Kerr
  Cc: devicetree-discuss, linuxppc-dev, sparclinux, microblaze-uclinux,
	benh, sfr, davem, monstr

On Mon, Dec 7, 2009 at 12:08 AM, Jeremy Kerr <jeremy.kerr@canonical.com> wrote:
> Hi Grant,
>
>> +     /* Scan memory nodes and rebuild LMBs */
>> +     lmb_init();
>> +     of_scan_flat_dt(early_init_dt_scan_root, NULL);
>> +     of_scan_flat_dt(early_init_dt_scan_memory, NULL);
>> +
>> +     /* Save command line for /proc/cmdline and then parse parameters */
>> +     strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
>> +     parse_early_param();
>> +
>> +     /* This is in an arbitrary spot, but it is temporary.  After all
>> +      * the common code is merged, the structure of the early init
>> +      * code will be reevaluated and refactored */
>> +     early_init_devtree_arch();
>> +
>> +     lmb_analyze();
>> +     lmb_dump_all();
>
> So we're assuming that the arch has lmb support, or should we make this
> conditional on CONFIG_HAVE_LMB?

I'm not making any assumptions yet.  I'm just merging the code.  A lot
of it needs to be refactored after the merge.  Feel free to send
patches to rework want you need.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree()
@ 2009-12-11  6:20       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:20 UTC (permalink / raw)
  To: Jeremy Kerr
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Mon, Dec 7, 2009 at 12:08 AM, Jeremy Kerr <jeremy.kerr@canonical.com> wr=
ote:
> Hi Grant,
>
>> + =A0 =A0 /* Scan memory nodes and rebuild LMBs */
>> + =A0 =A0 lmb_init();
>> + =A0 =A0 of_scan_flat_dt(early_init_dt_scan_root, NULL);
>> + =A0 =A0 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
>> +
>> + =A0 =A0 /* Save command line for /proc/cmdline and then parse paramete=
rs */
>> + =A0 =A0 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
>> + =A0 =A0 parse_early_param();
>> +
>> + =A0 =A0 /* This is in an arbitrary spot, but it is temporary. =A0After=
 all
>> + =A0 =A0 =A0* the common code is merged, the structure of the early ini=
t
>> + =A0 =A0 =A0* code will be reevaluated and refactored */
>> + =A0 =A0 early_init_devtree_arch();
>> +
>> + =A0 =A0 lmb_analyze();
>> + =A0 =A0 lmb_dump_all();
>
> So we're assuming that the arch has lmb support, or should we make this
> conditional on CONFIG_HAVE_LMB?

I'm not making any assumptions yet.  I'm just merging the code.  A lot
of it needs to be refactored after the merge.  Feel free to send
patches to rework want you need.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
  2009-11-26  5:27         ` Benjamin Herrenschmidt
  (?)
@ 2009-12-11  6:43           ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:43 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Wed, Nov 25, 2009 at 10:27 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Wed, 2009-11-25 at 21:05 -0700, Grant Likely wrote:
>>
>> You're right, it's not, but makes merging less complex, and then I can
>> refactor properly.
>
> Still, make them __be32 at least

Okay.  Done.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-12-11  6:43           ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:43 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, devicetree-discuss, sparclinux, microblaze-uclinux,
	sfr, davem, monstr

On Wed, Nov 25, 2009 at 10:27 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Wed, 2009-11-25 at 21:05 -0700, Grant Likely wrote:
>>
>> You're right, it's not, but makes merging less complex, and then I can
>> refactor properly.
>
> Still, make them __be32 at least

Okay.  Done.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 04/11] of/flattree: eliminate cell_t typedef
@ 2009-12-11  6:43           ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:43 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Wed, Nov 25, 2009 at 10:27 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Wed, 2009-11-25 at 21:05 -0700, Grant Likely wrote:
>>
>> You're right, it's not, but makes merging less complex, and then I can
>> refactor properly.
>
> Still, make them __be32 at least

Okay.  Done.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 07/11] of: merge machine_is_compatible()
  2009-11-26  4:05     ` Benjamin Herrenschmidt
  (?)
@ 2009-12-11  6:54       ` Grant Likely
  -1 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Wed, Nov 25, 2009 at 9:05 PM, Benjamin Herrenschmidt
<benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org> wrote:
> On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>
> I don't like moving this one to common code without the of_ prefix. I
> think you should move it with the of_ prefix, and then add a alias in
> powerpc and microblaze without of_ in a header until we fix all call
> sites (which you can put on your to-do list :-)

I've written another patch to rename it.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 07/11] of: merge machine_is_compatible()
@ 2009-12-11  6:54       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q

On Wed, Nov 25, 2009 at 9:05 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>
> I don't like moving this one to common code without the of_ prefix. I
> think you should move it with the of_ prefix, and then add a alias in
> powerpc and microblaze without of_ in a header until we fix all call
> sites (which you can put on your to-do list :-)

I've written another patch to rename it.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 07/11] of: merge machine_is_compatible()
@ 2009-12-11  6:54       ` Grant Likely
  0 siblings, 0 replies; 123+ messages in thread
From: Grant Likely @ 2009-12-11  6:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: sfr, monstr, microblaze-uclinux, devicetree-discuss, sparclinux,
	linuxppc-dev, davem

On Wed, Nov 25, 2009 at 9:05 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Tue, 2009-11-24 at 01:19 -0700, Grant Likely wrote:
>> Merge common code between PowerPC and Microblaze
>
> I don't like moving this one to common code without the of_ prefix. I
> think you should move it with the of_ prefix, and then add a alias in
> powerpc and microblaze without of_ in a header until we fix all call
> sites (which you can put on your to-do list :-)

I've written another patch to rename it.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

end of thread, other threads:[~2009-12-11  6:54 UTC | newest]

Thread overview: 123+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-24  8:17 [PATCH 00/11] Yet another series of OF merge patches Grant Likely
2009-11-24  8:17 ` Grant Likely
2009-11-24  8:17 ` Grant Likely
2009-11-24  8:17 ` [PATCH 01/11] of/flattree: Merge early_init_dt_check_for_initrd() Grant Likely
2009-11-24  8:17   ` Grant Likely
2009-11-24  8:17   ` Grant Likely
2009-11-26  3:51   ` Benjamin Herrenschmidt
2009-11-26  3:51     ` [PATCH 01/11] of/flattree: Merge Benjamin Herrenschmidt
2009-11-26  4:02     ` [PATCH 01/11] of/flattree: Merge early_init_dt_check_for_initrd() Grant Likely
2009-11-26  4:02       ` Grant Likely
2009-11-26  4:02       ` Grant Likely
2009-11-24  8:18 ` [PATCH 02/11] of/flattree: Merge earlyinit_dt_scan_root() Grant Likely
2009-11-24  8:18   ` Grant Likely
2009-11-24  8:18   ` Grant Likely
2009-11-26  3:54   ` Benjamin Herrenschmidt
2009-11-26  3:54     ` Benjamin Herrenschmidt
2009-11-26  3:54     ` Benjamin Herrenschmidt
2009-11-26  4:03     ` Grant Likely
2009-11-26  4:03       ` Grant Likely
2009-11-26  4:03       ` Grant Likely
2009-11-24  8:18 ` [PATCH 03/11] of/flattree: merge dt_mem_next_cell Grant Likely
2009-11-24  8:18   ` Grant Likely
2009-11-24  8:18   ` Grant Likely
2009-11-26  3:55   ` Benjamin Herrenschmidt
2009-11-26  3:55     ` Benjamin Herrenschmidt
2009-11-26  3:55     ` Benjamin Herrenschmidt
2009-11-24  8:18 ` [PATCH 04/11] of/flattree: eliminate cell_t typedef Grant Likely
2009-11-24  8:18   ` Grant Likely
2009-11-24  8:18   ` Grant Likely
2009-11-26  3:59   ` Benjamin Herrenschmidt
2009-11-26  3:59     ` Benjamin Herrenschmidt
2009-11-26  3:59     ` Benjamin Herrenschmidt
2009-11-26  4:05     ` Grant Likely
2009-11-26  4:05       ` Grant Likely
2009-11-26  4:05       ` Grant Likely
2009-11-26  5:27       ` Benjamin Herrenschmidt
2009-11-26  5:27         ` Benjamin Herrenschmidt
2009-11-26 21:36         ` Segher Boessenkool
2009-11-26 21:36           ` Segher Boessenkool
2009-11-26 21:36           ` Segher Boessenkool
2009-11-26 21:40           ` Benjamin Herrenschmidt
2009-11-26 21:40             ` Benjamin Herrenschmidt
2009-11-26 21:40             ` Benjamin Herrenschmidt
2009-11-26 23:32           ` David Miller
2009-11-26 23:32             ` David Miller
2009-11-26 23:32             ` David Miller
2009-12-11  6:43         ` Grant Likely
2009-12-11  6:43           ` Grant Likely
2009-12-11  6:43           ` Grant Likely
     [not found]       ` <fa686aa40911252005o2db85dfk3d9acc61c12ca5e5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-11-26  6:28         ` M. Warner Losh
2009-11-26  6:28           ` M. Warner Losh
2009-11-26  6:28           ` M. Warner Losh
     [not found]           ` <20091125.232818.-1350498258.imp-uzTCJ5RojNnQT0dZR+AlfA@public.gmane.org>
2009-11-26  7:06             ` Benjamin Herrenschmidt
2009-11-26  7:06               ` Benjamin Herrenschmidt
2009-11-26  7:06               ` Benjamin Herrenschmidt
2009-11-26  7:52               ` Mitch Bradley
2009-11-26  7:52                 ` Mitch Bradley
2009-11-26  7:52                 ` Mitch Bradley
2009-11-24  8:18 ` [PATCH 05/11] of/flattree: merge early_init_dt_scan_chosen() Grant Likely
2009-11-24  8:18   ` Grant Likely
2009-11-24  8:18   ` Grant Likely
2009-11-24  8:19 ` [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree() Grant Likely
2009-11-24  8:19   ` Grant Likely
2009-11-24  8:19   ` [PATCH 06/11] of/flattree: merge early_init_devtree() and Grant Likely
2009-11-26  4:04   ` [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree() Benjamin Herrenschmidt
2009-11-26  4:04     ` Benjamin Herrenschmidt
2009-11-26  4:04     ` [PATCH 06/11] of/flattree: merge early_init_devtree() and Benjamin Herrenschmidt
2009-12-11  6:19     ` [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree() Grant Likely
2009-12-11  6:19       ` Grant Likely
2009-12-11  6:19       ` [PATCH 06/11] of/flattree: merge early_init_devtree() and Grant Likely
2009-12-07  7:08   ` [PATCH 06/11] of/flattree: merge early_init_devtree() and early_init_move_devtree() Jeremy Kerr
2009-12-07  7:08     ` Jeremy Kerr
2009-12-07  7:08     ` Jeremy Kerr
2009-12-11  6:20     ` Grant Likely
2009-12-11  6:20       ` Grant Likely
2009-12-11  6:20       ` [PATCH 06/11] of/flattree: merge early_init_devtree() and Grant Likely
2009-11-24  8:19 ` [PATCH 07/11] of: merge machine_is_compatible() Grant Likely
2009-11-24  8:19   ` Grant Likely
2009-11-24  8:19   ` Grant Likely
2009-11-26  4:05   ` Benjamin Herrenschmidt
2009-11-26  4:05     ` Benjamin Herrenschmidt
2009-11-26  4:05     ` Benjamin Herrenschmidt
2009-12-11  6:54     ` Grant Likely
2009-12-11  6:54       ` Grant Likely
2009-12-11  6:54       ` Grant Likely
2009-11-24  8:19 ` [PATCH 08/11] of: Merge of_node_get() and of_node_put() Grant Likely
2009-11-24  8:19   ` Grant Likely
2009-11-24  8:19   ` Grant Likely
2009-11-26  4:06   ` Benjamin Herrenschmidt
2009-11-26  4:06     ` Benjamin Herrenschmidt
2009-11-26  4:06     ` Benjamin Herrenschmidt
2009-11-24  8:19 ` [PATCH 09/11] of: merge of_attach_node() & of_detach_node() Grant Likely
2009-11-24  8:19   ` Grant Likely
2009-11-24  8:19   ` Grant Likely
2009-11-26  4:07   ` Benjamin Herrenschmidt
2009-11-26  4:07     ` Benjamin Herrenschmidt
2009-11-26  4:07     ` Benjamin Herrenschmidt
2009-12-10 22:21     ` Grant Likely
2009-12-10 22:21       ` Grant Likely
2009-12-10 22:21       ` Grant Likely
2009-11-24  8:19 ` [PATCH 10/11] microblaze: gut implementation of early_init_dt_scan_cpus() Grant Likely
2009-11-24  8:19   ` Grant Likely
2009-11-24  8:19   ` [PATCH 10/11] microblaze: gut implementation of Grant Likely
2009-11-24  8:20 ` [PATCH 11/11] of: unify phandle name in struct device_node Grant Likely
2009-11-24  8:20   ` Grant Likely
2009-11-24  8:20   ` Grant Likely
2009-11-24 17:37   ` David Miller
2009-11-24 17:37     ` David Miller
2009-11-24 17:37     ` David Miller
2009-11-24 20:33     ` Grant Likely
2009-11-24 20:33       ` Grant Likely
2009-11-24 20:33       ` Grant Likely
2009-11-24 21:10       ` David Miller
2009-11-24 21:10         ` David Miller
     [not found]     ` <20091124.093732.203692950.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2009-11-24 21:06       ` Benjamin Herrenschmidt
2009-11-24 21:06         ` Benjamin Herrenschmidt
2009-11-24 21:06         ` Benjamin Herrenschmidt
2009-11-24 21:39         ` Grant Likely
2009-11-24 21:39           ` Grant Likely
2009-11-24 21:39           ` Grant Likely
2009-11-26 12:28 ` [PATCH 00/11] Yet another series of OF merge patches Wolfram Sang
2009-11-26 12:28   ` Wolfram Sang
2009-11-26 12:28   ` Wolfram Sang

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.