Skip to contentSkip to conversation

Random OF cleanups and merges

PATCH In review Grant Likely 7 participants 33 messages Feb 13, 2010 – Feb 14, 2010

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Random OF cleanups and merges

Here's another batch of cleanup patches from my test-devicetree branch. A number of cleanups, corrections and minor merges of common code. Also a patch from Jeremy to make the flat tree work on architectures without LMB (arm).

Once I've collected acks on these, I'll move them over to my next-devicetree branch on git://git.secretlab.ca/git/linux-2.6

Cheers,
g.

---

Grant Likely (6):
of: remove undefined request_OF_resource & release_OF_resource of/sparc: Remove sparc-local declaration of allnodes and devtree_lock
of: move definition of of_chosen into common code.
of: remove unused extern reference to devtree_lock
of: put default string compare and #a/s-cell values into common header
of: Remove old and misplaced function declarations

Jeremy Kerr (3):
of/flattree: Don't assume HAVE_LMB
of: protect linux/of.h with CONFIG_OF
proc_devtree: fix THIS_MODULE without module.h

 arch/microblaze/include/asm/prom.h |   15 ---------------
 arch/microblaze/kernel/prom.c      |    8 +++++---
 arch/powerpc/include/asm/prom.h    |   14 --------------
 arch/powerpc/kernel/prom.c         |   10 +++++-----
 arch/sparc/kernel/prom.h           |    3 ---
 drivers/of/base.c                  |    1 +
 drivers/of/fdt.c                   |    9 ++++++---
 fs/proc/proc_devtree.c             |    1 +
 include/linux/of.h                 |   27 +++++++++++++++++++++++++++
 include/linux/of_fdt.h             |   11 +----------
 10 files changed, 46 insertions(+), 53 deletions(-)
#1 lore raw

PATCH 1/9 of: Remove old and misplaced function declarations

The following functions don't exist:
finish_device_tree()
print_properties()
prom_n_intr_cells()
prom_get_irq_senses()

The following functions are in drivers/of/base.c, so the declaration belongs in of.h instead of of_fdt.h
of_machine_is_compatible()
prom_add_property()
prom_remove_property()
prom_update_property()

---

 include/linux/of.h     |    8 ++++++++
 include/linux/of_fdt.h |   10 ----------
 2 files changed, 8 insertions(+), 10 deletions(-)
include/linux/of.h +8 -0
index fa5571b..5c7b6a6 100644
@@ -180,6 +180,14 @@ extern int of_parse_phandles_with_args(struct device_node *np,
 	const char *list_name, const char *cells_name, int index,
 	struct device_node **out_node, const void **out_args);
 
+extern int of_machine_is_compatible(const char *compat);
+
+extern int prom_add_property(struct device_node* np, struct property* prop);
+extern int prom_remove_property(struct device_node *np, struct property *prop);
+extern int prom_update_property(struct device_node *np,
+				struct property *newprop,
+				struct property *oldprop);
+
 #if defined(CONFIG_OF_DYNAMIC)
 /* For updating the device tree at runtime */
 extern void of_attach_node(struct device_node *);
include/linux/of_fdt.h +0 -10
index 0007187..c9cb8a7 100644
@@ -95,18 +95,8 @@ 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);
 extern void early_init_devtree(void *);
-extern int of_machine_is_compatible(const char *compat);
-extern void print_properties(struct device_node *node);
-extern int prom_n_intr_cells(struct device_node* np);
-extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
-extern int prom_add_property(struct device_node* np, struct property* prop);
-extern int prom_remove_property(struct device_node *np, struct property *prop);
-extern int prom_update_property(struct device_node *np,
-				struct property *newprop,
-				struct property *oldprop);
 
 #endif /* __ASSEMBLY__ */
 #endif /* _LINUX_OF_FDT_H */
Acked-by on v1 1/9
#2 lore raw

Re: [PATCH 1/9] of: Remove old and misplaced function declarations

Quoted 6 lines · Grant Likely

The following functions don't exist:
finish_device_tree()
print_properties()
prom_n_intr_cells()
prom_get_irq_senses()

Quoted 8 lines

The following functions are in drivers/of/base.c, so the declaration belongs in of.h instead of of_fdt.h
of_machine_is_compatible()
prom_add_property()
prom_remove_property()
prom_update_property()

Quoted 48 lines

---

 include/linux/of.h     |    8 ++++++++
 include/linux/of_fdt.h |   10 ----------
 2 files changed, 8 insertions(+), 10 deletions(-)
include/linux/of.h +8 -0
index fa5571b..5c7b6a6 100644
@@ -180,6 +180,14 @@ extern int of_parse_phandles_with_args(struct device_node *np,
 	const char *list_name, const char *cells_name, int index,
 	struct device_node **out_node, const void **out_args);
 
+extern int of_machine_is_compatible(const char *compat);
+
+extern int prom_add_property(struct device_node* np, struct property* prop);
+extern int prom_remove_property(struct device_node *np, struct property *prop);
+extern int prom_update_property(struct device_node *np,
+				struct property *newprop,
+				struct property *oldprop);
+
 #if defined(CONFIG_OF_DYNAMIC)
 /* For updating the device tree at runtime */
 extern void of_attach_node(struct device_node *);
include/linux/of_fdt.h +0 -10
index 0007187..c9cb8a7 100644
@@ -95,18 +95,8 @@ 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);
 extern void early_init_devtree(void *);
-extern int of_machine_is_compatible(const char *compat);
-extern void print_properties(struct device_node *node);
-extern int prom_n_intr_cells(struct device_node* np);
-extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
-extern int prom_add_property(struct device_node* np, struct property* prop);
-extern int prom_remove_property(struct device_node *np, struct property *prop);
-extern int prom_update_property(struct device_node *np,
-				struct property *newprop,
-				struct property *oldprop);
 
 #endif /* __ASSEMBLY__ */
 #endif /* _LINUX_OF_FDT_H */
#3 lore raw

PATCH 2/9 proc_devtree: fix THIS_MODULE without module.h

In reply to Grant Likely

From: Jeremy Kerr <[email protected]>

Commit e22f628395432b967f2f505858c64450f7835365 introduced a build breakage for ARM devtree work: the THIS_MODULE macro was added, but we don't have module.h

This change adds the necessary #include to get THIS_MODULE defined. While we could just replace it with NULL (PROC_FS is a bool, not a tristate), using THIS_MODULE will prevent unexpected breakage if we ever do compile this as a module.

---

 fs/proc/proc_devtree.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/proc/proc_devtree.c +1 -0
index 0ec4511..f8650dc 100644
@@ -11,6 +11,7 @@
 #include <linux/stat.h>
 #include <linux/string.h>
 #include <linux/of.h>
+#include <linux/module.h>
 #include <asm/prom.h>
 #include <asm/uaccess.h>
 #include "internal.h"
Acked-by on v1 2/9
#4 lore raw

Re: [PATCH 2/9] proc_devtree: fix THIS_MODULE without module.h

Quoted 6 lines · Grant Likely

From: Jeremy Kerr <[email protected]>

Commit e22f628395432b967f2f505858c64450f7835365 introduced a build breakage for ARM devtree work: the THIS_MODULE macro was added, but we don't have module.h

Quoted 7 lines

This change adds the necessary #include to get THIS_MODULE defined. While we could just replace it with NULL (PROC_FS is a bool, not a tristate), using THIS_MODULE will prevent unexpected breakage if we ever do compile this as a module.

Quoted 17 lines

---

 fs/proc/proc_devtree.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/proc/proc_devtree.c +1 -0
index 0ec4511..f8650dc 100644
@@ -11,6 +11,7 @@
 #include <linux/stat.h>
 #include <linux/string.h>
 #include <linux/of.h>
+#include <linux/module.h>
 #include <asm/prom.h>
 #include <asm/uaccess.h>
 #include "internal.h"
#5 lore raw

PATCH 2/9 proc_devtree: fix THIS_MODULE without module.h

In reply to Grant Likely

From: Jeremy Kerr <[email protected]>

Commit e22f628395432b967f2f505858c64450f7835365 introduced a build breakage for ARM devtree work: the THIS_MODULE macro was added, but we don't have module.h

This change adds the necessary #include to get THIS_MODULE defined. While we could just replace it with NULL (PROC_FS is a bool, not a tristate), using THIS_MODULE will prevent unexpected breakage if we ever do compile this as a module.

---

 fs/proc/proc_devtree.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/proc/proc_devtree.c +1 -0
index 0ec4511..f8650dc 100644
@@ -11,6 +11,7 @@
 #include <linux/stat.h>
 #include <linux/string.h>
 #include <linux/of.h>
+#include <linux/module.h>
 #include <asm/prom.h>
 #include <asm/uaccess.h>
 #include "internal.h"
#6 lore raw

PATCH 3/9 of: protect linux/of.h with CONFIG_OF

In reply to Grant Likely

From: Jeremy Kerr <[email protected]>

For platforms that have CONFIG_OF optional, we need to make the contents of linux/of.h conditional on CONFIG_OF.

---

 include/linux/of.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/linux/of.h +3 -0
index 5c7b6a6..48b0ee6 100644
@@ -22,6 +22,8 @@
 
 #include <asm/byteorder.h>
 
+#ifdef CONFIG_OF
+
 typedef u32 phandle;
 typedef u32 ihandle;
 
@@ -194,4 +196,5 @@ extern void of_attach_node(struct device_node *);
 extern void of_detach_node(struct device_node *);
 #endif
 
+#endif /* CONFIG_OF */
 #endif /* _LINUX_OF_H */
Acked-by on v1 3/9
#7 lore raw

Re: [PATCH 3/9] of: protect linux/of.h with CONFIG_OF

Quoted 7 lines · Grant Likely

From: Jeremy Kerr <[email protected]>

For platforms that have CONFIG_OF optional, we need to make the contents of linux/of.h conditional on CONFIG_OF.

For now...

In the long run, maybe we want some of the iterators to be empty inlines returning NULL ?

Cheers,
Ben.

Quoted 24 lines

---

 include/linux/of.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/linux/of.h +3 -0
index 5c7b6a6..48b0ee6 100644
@@ -22,6 +22,8 @@
 
 #include <asm/byteorder.h>
 
+#ifdef CONFIG_OF
+
 typedef u32 phandle;
 typedef u32 ihandle;
 
@@ -194,4 +196,5 @@ extern void of_attach_node(struct device_node *);
 extern void of_detach_node(struct device_node *);
 #endif
 
+#endif /* CONFIG_OF */
 #endif /* _LINUX_OF_H */
Acked-by Benjamin Herrenschmidt
#8 lore raw

RE: Re: [PATCH 3/9] of: protect linux/of.h with CONFIG_OF

Please remove my email from your mailing list!!!!!!!

-----Original Message-----
From: owner-microblaze-uclinux-FR6EJeJVuqfA6Z3fQjNZrN9u6TNh0Fb7@public.gmane.org [mailto:owner-microblaze-uclinux-FR6EJeJVuqfA6Z3fQjNZrN9u6TNh0Fb7@public.gmane.org] On Behalf Of Benjamin Herrenschmidt
Sent: Sunday, February 14, 2010 8:11 AM
To: Grant Likely
Cc: [email protected]; [email protected]; [email protected]; davem-fT/PcQaiUtIeIZ0/[email protected]; microblaze-uclinux-rVRm/[email protected]; [email protected]; [email protected]; devicetree-discuss-uLR06cmDAlY/[email protected]; [email protected]
Subject: [microblaze-uclinux] Re: [PATCH 3/9] of: protect linux/of.h with CONFIG_OF

Quoted 7 lines · Grant Likely

From: Jeremy Kerr <[email protected]>

For platforms that have CONFIG_OF optional, we need to make the contents of linux/of.h conditional on CONFIG_OF.

For now...

In the long run, maybe we want some of the iterators to be empty inlines returning NULL ?

Cheers,
Ben.

Quoted 19 lines

---

 include/linux/of.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/linux/of.h +2 -0
index 5c7b6a6..48b0ee6 100644
@@ -22,6 +22,8 @@
 
 #include <asm/byteorder.h>
 
+#ifdef CONFIG_OF
+
 typedef u32 phandle;
 typedef u32 ihandle;
 

include/linux/of.h extern void of_attach_node(struct device_node *); · line 200

Quoted 5 lines
include/linux/of.h +1 -0
@@ -194,4 +196,5 @@ extern void of_attach_node(struct device_node *);
 extern void of_detach_node(struct device_node *);
 #endif
 
+#endif /* CONFIG_OF */
 #endif /* _LINUX_OF_H */

___________________________
microblaze-uclinux mailing list microblaze-uclinux-rVRm/[email protected] Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/

#9 lore raw

Re: [PATCH 3/9] of: protect linux/of.h with CONFIG_OF

In reply to Benjamin Herrenschmidt
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 7 lines · Grant Likely

From: Jeremy Kerr <[email protected]>

For platforms that have CONFIG_OF optional, we need to make the contents of linux/of.h conditional on CONFIG_OF.

Quoted 6 lines

For now...

In the long run, maybe we want some of the iterators to be empty inlines returning NULL ?

Yes. I'll add them as they are needed.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#10 lore raw

PATCH 3/9 of: protect linux/of.h with CONFIG_OF

In reply to Grant Likely

From: Jeremy Kerr <[email protected]>

For platforms that have CONFIG_OF optional, we need to make the contents of linux/of.h conditional on CONFIG_OF.

---

 include/linux/of.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/linux/of.h +3 -0
index 5c7b6a6..48b0ee6 100644
@@ -22,6 +22,8 @@
 
 #include <asm/byteorder.h>
 
+#ifdef CONFIG_OF
+
 typedef u32 phandle;
 typedef u32 ihandle;
 
@@ -194,4 +196,5 @@ extern void of_attach_node(struct device_node *);
 extern void of_detach_node(struct device_node *);
 #endif
 
+#endif /* CONFIG_OF */
 #endif /* _LINUX_OF_H */
#11 lore raw

PATCH 4/9 of/flattree: Don't assume HAVE_LMB

In reply to Grant Likely

From: Jeremy Kerr <[email protected]>

We don't always have lmb available, so make arches provide an early_init_dt_alloc_memory_arch() to handle the allocation of memory in the fdt code.

When we don't have lmb.h included, we need asm/page.h for __va.

---

 arch/microblaze/kernel/prom.c |    5 +++++
 arch/powerpc/kernel/prom.c    |    5 +++++
 drivers/of/fdt.c              |    9 ++++++---
 include/linux/of_fdt.h        |    1 +
 4 files changed, 17 insertions(+), 3 deletions(-)
arch/microblaze/kernel/prom.c +5 -0
index 050b799..a7dcaf0 100644
@@ -55,6 +55,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 	lmb_add(base, size);
 }
 
+u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+	return lmb_alloc(size, align);
+}
+
 #ifdef CONFIG_EARLY_PRINTK
 /* MS this is Microblaze specifig function */
 static int __init early_init_dt_scan_serial(unsigned long node,
arch/powerpc/kernel/prom.c +5 -0
index 43c78d7..5bbbdb2 100644
@@ -510,6 +510,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 	memstart_addr = min((u64)memstart_addr, base);
 }
 
+u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+	return lmb_alloc(size, align);
+}
+
 #ifdef CONFIG_BLK_DEV_INITRD
 void __init early_init_dt_setup_initrd_arch(unsigned long start,
 		unsigned long end)
drivers/of/fdt.c +6 -3
index b51f797..406757a 100644
@@ -10,16 +10,18 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/lmb.h>
 #include <linux/initrd.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
-
+#include <linux/string.h>
+#include <linux/errno.h>
 
 #ifdef CONFIG_PPC
 #include <asm/machdep.h>
 #endif /* CONFIG_PPC */
 
+#include <asm/page.h>
+
 int __initdata dt_root_addr_cells;
 int __initdata dt_root_size_cells;
 
@@ -560,7 +562,8 @@ void __init unflatten_device_tree(void)
 	pr_debug("  size is %lx, allocating...\n", size);
 
 	/* Allocate memory for the expanded device tree */
-	mem = lmb_alloc(size + 4, __alignof__(struct device_node));
+	mem = early_init_dt_alloc_memory_arch(size + 4,
+			__alignof__(struct device_node));
 	mem = (unsigned long) __va(mem);
 
 	((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
include/linux/of_fdt.h +1 -0
index c9cb8a7..a1ca92c 100644
@@ -78,6 +78,7 @@ extern void early_init_dt_check_for_initrd(unsigned long node);
 extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
 				     int depth, void *data);
 extern void early_init_dt_add_memory_arch(u64 base, u64 size);
+extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align);
 extern u64 dt_mem_next_cell(int s, __be32 **cellp);
 
 /*
Acked-by on v1 4/9
#12 lore raw

Re: [PATCH 4/9] of/flattree: Don't assume HAVE_LMB

Quoted 10 lines · Grant Likely

From: Jeremy Kerr <[email protected]>

We don't always have lmb available, so make arches provide an early_init_dt_alloc_memory_arch() to handle the allocation of memory in the fdt code.

When we don't have lmb.h included, we need asm/page.h for __va.

Quoted 87 lines

---

 arch/microblaze/kernel/prom.c |    5 +++++
 arch/powerpc/kernel/prom.c    |    5 +++++
 drivers/of/fdt.c              |    9 ++++++---
 include/linux/of_fdt.h        |    1 +
 4 files changed, 17 insertions(+), 3 deletions(-)
arch/microblaze/kernel/prom.c +5 -0
index 050b799..a7dcaf0 100644
@@ -55,6 +55,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 	lmb_add(base, size);
 }
 
+u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+	return lmb_alloc(size, align);
+}
+
 #ifdef CONFIG_EARLY_PRINTK
 /* MS this is Microblaze specifig function */
 static int __init early_init_dt_scan_serial(unsigned long node,
arch/powerpc/kernel/prom.c +5 -0
index 43c78d7..5bbbdb2 100644
@@ -510,6 +510,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 	memstart_addr = min((u64)memstart_addr, base);
 }
 
+u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+	return lmb_alloc(size, align);
+}
+
 #ifdef CONFIG_BLK_DEV_INITRD
 void __init early_init_dt_setup_initrd_arch(unsigned long start,
 		unsigned long end)
drivers/of/fdt.c +6 -3
index b51f797..406757a 100644
@@ -10,16 +10,18 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/lmb.h>
 #include <linux/initrd.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
-
+#include <linux/string.h>
+#include <linux/errno.h>
 
 #ifdef CONFIG_PPC
 #include <asm/machdep.h>
 #endif /* CONFIG_PPC */
 
+#include <asm/page.h>
+
 int __initdata dt_root_addr_cells;
 int __initdata dt_root_size_cells;
 
@@ -560,7 +562,8 @@ void __init unflatten_device_tree(void)
 	pr_debug("  size is %lx, allocating...\n", size);
 
 	/* Allocate memory for the expanded device tree */
-	mem = lmb_alloc(size + 4, __alignof__(struct device_node));
+	mem = early_init_dt_alloc_memory_arch(size + 4,
+			__alignof__(struct device_node));
 	mem = (unsigned long) __va(mem);
 
 	((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
include/linux/of_fdt.h +1 -0
index c9cb8a7..a1ca92c 100644
@@ -78,6 +78,7 @@ extern void early_init_dt_check_for_initrd(unsigned long node);
 extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
 				     int depth, void *data);
 extern void early_init_dt_add_memory_arch(u64 base, u64 size);
+extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align);
 extern u64 dt_mem_next_cell(int s, __be32 **cellp);
 
 /*
#13 lore raw

Re: [PATCH 4/9] of/flattree: Don't assume HAVE_LMB

In reply to Grant Likely
Quoted 59 lines · Grant Likely

From: Jeremy Kerr <[email protected]>

We don't always have lmb available, so make arches provide an early_init_dt_alloc_memory_arch() to handle the allocation of memory in the fdt code.

When we don't have lmb.h included, we need asm/page.h for __va.

---

 arch/microblaze/kernel/prom.c |    5 +++++
 arch/powerpc/kernel/prom.c    |    5 +++++
 drivers/of/fdt.c              |    9 ++++++---
 include/linux/of_fdt.h        |    1 +
 4 files changed, 17 insertions(+), 3 deletions(-)
arch/microblaze/kernel/prom.c +5 -0
index 050b799..a7dcaf0 100644
@@ -55,6 +55,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 	lmb_add(base, size);
 }
 
+u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+	return lmb_alloc(size, align);
+}
+
 #ifdef CONFIG_EARLY_PRINTK
 /* MS this is Microblaze specifig function */
 static int __init early_init_dt_scan_serial(unsigned long node,
arch/powerpc/kernel/prom.c +5 -0
index 43c78d7..5bbbdb2 100644
@@ -510,6 +510,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 	memstart_addr = min((u64)memstart_addr, base);
 }
 
+u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+	return lmb_alloc(size, align);
+}
+
 #ifdef CONFIG_BLK_DEV_INITRD
 void __init early_init_dt_setup_initrd_arch(unsigned long start,
 		unsigned long end)
drivers/of/fdt.c +0 -1
index b51f797..406757a 100644
@@ -10,16 +10,18 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/lmb.h>

drivers/of/fdt.c line 21

Quoted 10 lines
drivers/of/fdt.c +2 -1
 #include <linux/initrd.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
-
+#include <linux/string.h>
+#include <linux/errno.h>
 
 #ifdef CONFIG_PPC
 #include <asm/machdep.h>
 #endif /* CONFIG_PPC */

It is not part of your patch but I think that will be great completely remove this CONFIG_PPC part from generic OF file. Would it be possible to include your asm/machdep.h through asm/page.h or any other file?

Michal

Quoted 34 lines
drivers/of/fdt.c +4 -1
+#include <asm/page.h>
+
 int __initdata dt_root_addr_cells;
 int __initdata dt_root_size_cells;
 
@@ -560,7 +562,8 @@ void __init unflatten_device_tree(void)
 	pr_debug("  size is %lx, allocating...\n", size);
 
 	/* Allocate memory for the expanded device tree */
-	mem = lmb_alloc(size + 4, __alignof__(struct device_node));
+	mem = early_init_dt_alloc_memory_arch(size + 4,
+			__alignof__(struct device_node));
 	mem = (unsigned long) __va(mem);
 
 	((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
include/linux/of_fdt.h +1 -1
index c9cb8a7..a1ca92c 100644
@@ -78,6 +78,7 @@ extern void early_init_dt_check_for_initrd(unsigned long node);
 extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
 				     int depth, void *data);
 extern void early_init_dt_add_memory_arch(u64 base, u64 size);
+extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align);
 extern u64 dt_mem_next_cell(int s, __be32 **cellp);
 
 /*
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 3 lines
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663
#14 lore raw

Re: [PATCH 4/9] of/flattree: Don't assume HAVE_LMB

Quoted 66 lines · Michal Simek
Quoted 65 lines · Grant Likely

From: Jeremy Kerr <[email protected]>

We don't always have lmb available, so make arches provide an early_init_dt_alloc_memory_arch() to handle the allocation of memory in the fdt code.

When we don't have lmb.h included, we need asm/page.h for __va.

---

 arch/microblaze/kernel/prom.c |    5 +++++
 arch/powerpc/kernel/prom.c    |    5 +++++
 drivers/of/fdt.c              |    9 ++++++---
 include/linux/of_fdt.h        |    1 +

 4 files changed, 17 insertions(+), 3 deletions(-)
arch/microblaze/kernel/prom.c +4 -0
index 050b799..a7dcaf0 100644
@@ -55,6 +55,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64
 size)
        lmb_add(base, size);
  }
  +u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+       return lmb_alloc(size, align);
+}
+
  #ifdef CONFIG_EARLY_PRINTK
  /* MS this is Microblaze specifig function */

 static int __init early_init_dt_scan_serial(unsigned long node,

arch/powerpc/kernel/prom.c +4 -0
index 43c78d7..5bbbdb2 100644
@@ -510,6 +510,11 @@ void __init early_init_dt_add_memory_arch(u64 base,
 u64 size)
        memstart_addr = min((u64)memstart_addr, base);
  }
  +u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+       return lmb_alloc(size, align);
+}
+
  #ifdef CONFIG_BLK_DEV_INITRD
  void __init early_init_dt_setup_initrd_arch(unsigned long start,

               unsigned long end)

drivers/of/fdt.c +2 -2
index b51f797..406757a 100644
@@ -10,16 +10,18 @@
  */
   #include <linux/kernel.h>
-#include <linux/lmb.h>
  #include <linux/initrd.h>
  #include <linux/of.h>
  #include <linux/of_fdt.h>
-
+#include <linux/string.h>
+#include <linux/errno.h>
Quoted 8 lines

drivers/of/fdt.c line 21

Quoted 3 lines
drivers/of/fdt.c +0 -0
   #ifdef CONFIG_PPC
  #include <asm/machdep.h>
  #endif /* CONFIG_PPC */

It is not part of your patch but I think that will be great completely remove this CONFIG_PPC part from generic OF file.
Would it be possible to include your asm/machdep.h through asm/page.h or any other file?

Yup. I'll get there unless someone else beats me to it. :-)

Quoted 41 lines

Michal

Quoted 26 lines

 +#include <asm/page.h>
+
 int __initdata dt_root_addr_cells;
 int __initdata dt_root_size_cells;
 @@ -560,7 +562,8 @@ void __init unflatten_device_tree(void) pr_debug("  size is %lx, allocating...\n", size); /* Allocate memory for the expanded device tree */
-       mem = lmb_alloc(size + 4, __alignof__(struct device_node));
+       mem = early_init_dt_alloc_memory_arch(size + 4,
+                       __alignof__(struct device_node)); mem = (unsigned long) __va(mem);
         ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);

include/linux/of_fdt.h +0 -0
index c9cb8a7..a1ca92c 100644
@@ -78,6 +78,7 @@ extern void early_init_dt_check_for_initrd(unsigned long
 node);

 extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
                                    int depth, void *data); extern void early_init_dt_add_memory_arch(u64 base, u64 size); +extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align); extern u64 dt_mem_next_cell(int s, __be32 **cellp);
  /*

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

--
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663

Signature · 6 lines
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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#15 lore raw

PATCH 4/9 of/flattree: Don't assume HAVE_LMB

In reply to Grant Likely

From: Jeremy Kerr <[email protected]>

We don't always have lmb available, so make arches provide an early_init_dt_alloc_memory_arch() to handle the allocation of memory in the fdt code.

When we don't have lmb.h included, we need asm/page.h for __va.

---

 arch/microblaze/kernel/prom.c |    5 +++++
 arch/powerpc/kernel/prom.c    |    5 +++++
 drivers/of/fdt.c              |    9 ++++++---
 include/linux/of_fdt.h        |    1 +
 4 files changed, 17 insertions(+), 3 deletions(-)
arch/microblaze/kernel/prom.c +5 -0
index 050b799..a7dcaf0 100644
@@ -55,6 +55,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 	lmb_add(base, size);
 }
 
+u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+	return lmb_alloc(size, align);
+}
+
 #ifdef CONFIG_EARLY_PRINTK
 /* MS this is Microblaze specifig function */
 static int __init early_init_dt_scan_serial(unsigned long node,
arch/powerpc/kernel/prom.c +5 -0
index 43c78d7..5bbbdb2 100644
@@ -510,6 +510,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 	memstart_addr = min((u64)memstart_addr, base);
 }
 
+u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+	return lmb_alloc(size, align);
+}
+
 #ifdef CONFIG_BLK_DEV_INITRD
 void __init early_init_dt_setup_initrd_arch(unsigned long start,
 		unsigned long end)
drivers/of/fdt.c +6 -3
index b51f797..406757a 100644
@@ -10,16 +10,18 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/lmb.h>
 #include <linux/initrd.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
-
+#include <linux/string.h>
+#include <linux/errno.h>
 
 #ifdef CONFIG_PPC
 #include <asm/machdep.h>
 #endif /* CONFIG_PPC */
 
+#include <asm/page.h>
+
 int __initdata dt_root_addr_cells;
 int __initdata dt_root_size_cells;
 
@@ -560,7 +562,8 @@ void __init unflatten_device_tree(void)
 	pr_debug("  size is %lx, allocating...\n", size);
 
 	/* Allocate memory for the expanded device tree */
-	mem = lmb_alloc(size + 4, __alignof__(struct device_node));
+	mem = early_init_dt_alloc_memory_arch(size + 4,
+			__alignof__(struct device_node));
 	mem = (unsigned long) __va(mem);
 
 	((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
include/linux/of_fdt.h +1 -0
index c9cb8a7..a1ca92c 100644
@@ -78,6 +78,7 @@ extern void early_init_dt_check_for_initrd(unsigned long node);
 extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
 				     int depth, void *data);
 extern void early_init_dt_add_memory_arch(u64 base, u64 size);
+extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align);
 extern u64 dt_mem_next_cell(int s, __be32 **cellp);
 
 /*
#16 lore raw

PATCH 5/9 of: put default string compare and #a/s-cell values into common header

In reply to Grant Likely

Most architectures don't need to change these. Put them into common code to eliminate some duplication

---

 arch/microblaze/include/asm/prom.h |    7 -------
 arch/powerpc/include/asm/prom.h    |    7 -------
 include/linux/of.h                 |   13 +++++++++++++
 3 files changed, 13 insertions(+), 14 deletions(-)
arch/microblaze/include/asm/prom.h +0 -7
index 6c6b386..ddc5c57 100644
@@ -26,13 +26,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT	1
-#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT	1
-
-#define of_compat_cmp(s1, s2, l)	strncasecmp((s1), (s2), (l))
-#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
-#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
-
 extern struct device_node *of_chosen;
 
 #define HAVE_ARCH_DEVTREE_FIXUPS
arch/powerpc/include/asm/prom.h +0 -7
index f384db8..4a5070e 100644
@@ -23,13 +23,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT	1
-#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT	1
-
-#define of_compat_cmp(s1, s2, l)	strcasecmp((s1), (s2))
-#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
-#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
-
 extern struct device_node *of_chosen;
 
 #define HAVE_ARCH_DEVTREE_FIXUPS
include/linux/of.h +13 -0
index 48b0ee6..5cd2840 100644
@@ -116,6 +116,19 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
 
 #include <asm/prom.h>
 
+/* Default #address and #size cells.  Allow arch asm/prom.h to override */
+#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
+#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
+#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
+#endif
+
+/* Default string compare functions, Allow arch asm/prom.h to override */
+#if !defined(of_compat_cmp)
+#define of_compat_cmp(s1, s2, l)	strncasecmp((s1), (s2), (l))
+#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
+#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
+#endif
+
 /* flag descriptions */
 #define OF_DYNAMIC	1 /* node and properties were allocated via kmalloc */
 #define OF_DETACHED	2 /* node has been detached from the device tree */
Acked-by on v1 5/9
#17 lore raw

Re: [PATCH 5/9] of: put default string compare and #a/s-cell values into common header

Quoted 5 lines · Grant Likely

Most architectures don't need to change these. Put them into common code to eliminate some duplication

---

Quoted 72 lines
 arch/microblaze/include/asm/prom.h |    7 -------
 arch/powerpc/include/asm/prom.h    |    7 -------
 include/linux/of.h                 |   13 +++++++++++++
 3 files changed, 13 insertions(+), 14 deletions(-)
arch/microblaze/include/asm/prom.h +0 -7
index 6c6b386..ddc5c57 100644
@@ -26,13 +26,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT	1
-#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT	1
-
-#define of_compat_cmp(s1, s2, l)	strncasecmp((s1), (s2), (l))
-#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
-#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
-
 extern struct device_node *of_chosen;
 
 #define HAVE_ARCH_DEVTREE_FIXUPS
arch/powerpc/include/asm/prom.h +0 -7
index f384db8..4a5070e 100644
@@ -23,13 +23,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT	1
-#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT	1
-
-#define of_compat_cmp(s1, s2, l)	strcasecmp((s1), (s2))
-#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
-#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
-
 extern struct device_node *of_chosen;
 
 #define HAVE_ARCH_DEVTREE_FIXUPS
include/linux/of.h +13 -1
index 48b0ee6..5cd2840 100644
@@ -116,6 +116,19 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
 
 #include <asm/prom.h>
 
+/* Default #address and #size cells.  Allow arch asm/prom.h to override */
+#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
+#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
+#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
+#endif
+
+/* Default string compare functions, Allow arch asm/prom.h to override */
+#if !defined(of_compat_cmp)
+#define of_compat_cmp(s1, s2, l)	strncasecmp((s1), (s2), (l))
+#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
+#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
+#endif
+
 /* flag descriptions */
 #define OF_DYNAMIC	1 /* node and properties were allocated via kmalloc */
 #define OF_DETACHED	2 /* node has been detached from the device tree */
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#18 lore raw

PATCH 5/9 of: put default string compare and #a/s-cell values into common header

In reply to Grant Likely

Most architectures don't need to change these. Put them into common code to eliminate some duplication

---

 arch/microblaze/include/asm/prom.h |    7 -------
 arch/powerpc/include/asm/prom.h    |    7 -------
 include/linux/of.h                 |   13 +++++++++++++
 3 files changed, 13 insertions(+), 14 deletions(-)
arch/microblaze/include/asm/prom.h +0 -7
index 6c6b386..ddc5c57 100644
@@ -26,13 +26,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT	1
-#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT	1
-
-#define of_compat_cmp(s1, s2, l)	strncasecmp((s1), (s2), (l))
-#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
-#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
-
 extern struct device_node *of_chosen;
 
 #define HAVE_ARCH_DEVTREE_FIXUPS
arch/powerpc/include/asm/prom.h +0 -7
index f384db8..4a5070e 100644
@@ -23,13 +23,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT	1
-#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT	1
-
-#define of_compat_cmp(s1, s2, l)	strcasecmp((s1), (s2))
-#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
-#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
-
 extern struct device_node *of_chosen;
 
 #define HAVE_ARCH_DEVTREE_FIXUPS
include/linux/of.h +13 -0
index 48b0ee6..5cd2840 100644
@@ -116,6 +116,19 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
 
 #include <asm/prom.h>
 
+/* Default #address and #size cells.  Allow arch asm/prom.h to override */
+#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
+#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
+#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
+#endif
+
+/* Default string compare functions, Allow arch asm/prom.h to override */
+#if !defined(of_compat_cmp)
+#define of_compat_cmp(s1, s2, l)	strncasecmp((s1), (s2), (l))
+#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
+#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
+#endif
+
 /* flag descriptions */
 #define OF_DYNAMIC	1 /* node and properties were allocated via kmalloc */
 #define OF_DETACHED	2 /* node has been detached from the device tree */
#19 lore raw

PATCH 6/9 of: remove unused extern reference to devtree_lock

In reply to Grant Likely

Neither the powerpc nor the microblaze code use devtree_lock anymore. Remove the extern reference.

---

 arch/microblaze/include/asm/prom.h |    2 --
 arch/powerpc/kernel/prom.c         |    2 --
 2 files changed, 0 insertions(+), 4 deletions(-)
arch/microblaze/include/asm/prom.h +0 -2
index ddc5c57..8b1ebd3 100644
@@ -30,8 +30,6 @@ extern struct device_node *of_chosen;
 
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
-extern rwlock_t devtree_lock;	/* temporary while merging */
-
 /* Other Prototypes */
 extern int early_uartlite_console(void);
 
arch/powerpc/kernel/prom.c +0 -2
index 5bbbdb2..4869c93 100644
@@ -67,8 +67,6 @@ int __initdata iommu_force_on;
 unsigned long tce_alloc_start, tce_alloc_end;
 #endif
 
-extern rwlock_t devtree_lock;	/* temporary while merging */
-
 /* export that to outside world */
 struct device_node *of_chosen;
 
Acked-by on v1 6/9
#20 lore raw

Re: [PATCH 6/9] of: remove unused extern reference to devtree_lock

Quoted 5 lines · Grant Likely

Neither the powerpc nor the microblaze code use devtree_lock anymore. Remove the extern reference.

---

Quoted 36 lines
 arch/microblaze/include/asm/prom.h |    2 --
 arch/powerpc/kernel/prom.c         |    2 --
 2 files changed, 0 insertions(+), 4 deletions(-)
arch/microblaze/include/asm/prom.h +0 -2
index ddc5c57..8b1ebd3 100644
@@ -30,8 +30,6 @@ extern struct device_node *of_chosen;
 
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
-extern rwlock_t devtree_lock;	/* temporary while merging */
-
 /* Other Prototypes */
 extern int early_uartlite_console(void);
 
arch/powerpc/kernel/prom.c +0 -3
index 5bbbdb2..4869c93 100644
@@ -67,8 +67,6 @@ int __initdata iommu_force_on;
 unsigned long tce_alloc_start, tce_alloc_end;
 #endif
 
-extern rwlock_t devtree_lock;	/* temporary while merging */
-
 /* export that to outside world */
 struct device_node *of_chosen;
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#21 lore raw

PATCH 6/9 of: remove unused extern reference to devtree_lock

In reply to Grant Likely

Neither the powerpc nor the microblaze code use devtree_lock anymore. Remove the extern reference.

---

 arch/microblaze/include/asm/prom.h |    2 --
 arch/powerpc/kernel/prom.c         |    2 --
 2 files changed, 0 insertions(+), 4 deletions(-)
arch/microblaze/include/asm/prom.h +0 -2
index ddc5c57..8b1ebd3 100644
@@ -30,8 +30,6 @@ extern struct device_node *of_chosen;
 
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
-extern rwlock_t devtree_lock;	/* temporary while merging */
-
 /* Other Prototypes */
 extern int early_uartlite_console(void);
 
arch/powerpc/kernel/prom.c +0 -2
index 5bbbdb2..4869c93 100644
@@ -67,8 +67,6 @@ int __initdata iommu_force_on;
 unsigned long tce_alloc_start, tce_alloc_end;
 #endif
 
-extern rwlock_t devtree_lock;	/* temporary while merging */
-
 /* export that to outside world */
 struct device_node *of_chosen;
#22 lore raw

PATCH 7/9 of: move definition of of_chosen into common code.

In reply to Grant Likely

Rather than defining of_chosen in each arch, it can be defined for all in driver/of/base.c

---

 arch/microblaze/include/asm/prom.h |    2 --
 arch/microblaze/kernel/prom.c      |    3 ---
 arch/powerpc/include/asm/prom.h    |    2 --
 arch/powerpc/kernel/prom.c         |    3 ---
 drivers/of/base.c                  |    1 +
 include/linux/of.h                 |    1 +
 6 files changed, 2 insertions(+), 10 deletions(-)
arch/microblaze/include/asm/prom.h +0 -2
index 8b1ebd3..aa1a437 100644
@@ -26,8 +26,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-extern struct device_node *of_chosen;
-
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
 /* Other Prototypes */
arch/microblaze/kernel/prom.c +0 -3
index a7dcaf0..a15ef6d 100644
@@ -42,9 +42,6 @@
 #include <asm/sections.h>
 #include <asm/pci-bridge.h>
 
-/* export that to outside world */
-struct device_node *of_chosen;
-
 void __init early_init_dt_scan_chosen_arch(unsigned long node)
 {
 	/* No Microblaze specific code here */
arch/powerpc/include/asm/prom.h +0 -2
index 4a5070e..7f9a50a 100644
@@ -23,8 +23,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-extern struct device_node *of_chosen;
-
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
 #ifdef CONFIG_PPC32
arch/powerpc/kernel/prom.c +0 -3
index 4869c93..43238b2 100644
@@ -67,9 +67,6 @@ int __initdata iommu_force_on;
 unsigned long tce_alloc_start, tce_alloc_end;
 #endif
 
-/* export that to outside world */
-struct device_node *of_chosen;
-
 static int __init early_parse_mem(char *p)
 {
 	if (!p)
drivers/of/base.c +1 -0
index 873479a..cb96888 100644
@@ -23,6 +23,7 @@
 #include <linux/proc_fs.h>
 
 struct device_node *allnodes;
+struct device_node *of_chosen;
 
 /* use when traversing tree through the allnext, child, sibling,
  * or parent members of struct device_node.
include/linux/of.h +1 -0
index 5cd2840..d34cc5d 100644
@@ -66,6 +66,7 @@ struct device_node {
 
 /* Pointer for first entry in chain of all nodes. */
 extern struct device_node *allnodes;
+extern struct device_node *of_chosen;
 
 static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
 {
Acked-by on v1 7/9
#23 lore raw

Re: [PATCH 7/9] of: move definition of of_chosen into common code.

Quoted 4 lines · Grant Likely

Rather than defining of_chosen in each arch, it can be defined for all in driver/of/base.c

Quoted 94 lines

---

 arch/microblaze/include/asm/prom.h |    2 --
 arch/microblaze/kernel/prom.c      |    3 ---
 arch/powerpc/include/asm/prom.h    |    2 --
 arch/powerpc/kernel/prom.c         |    3 ---
 drivers/of/base.c                  |    1 +
 include/linux/of.h                 |    1 +
 6 files changed, 2 insertions(+), 10 deletions(-)
arch/microblaze/include/asm/prom.h +0 -2
index 8b1ebd3..aa1a437 100644
@@ -26,8 +26,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-extern struct device_node *of_chosen;
-
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
 /* Other Prototypes */
arch/microblaze/kernel/prom.c +0 -3
index a7dcaf0..a15ef6d 100644
@@ -42,9 +42,6 @@
 #include <asm/sections.h>
 #include <asm/pci-bridge.h>
 
-/* export that to outside world */
-struct device_node *of_chosen;
-
 void __init early_init_dt_scan_chosen_arch(unsigned long node)
 {
 	/* No Microblaze specific code here */
arch/powerpc/include/asm/prom.h +0 -2
index 4a5070e..7f9a50a 100644
@@ -23,8 +23,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-extern struct device_node *of_chosen;
-
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
 #ifdef CONFIG_PPC32
arch/powerpc/kernel/prom.c +0 -3
index 4869c93..43238b2 100644
@@ -67,9 +67,6 @@ int __initdata iommu_force_on;
 unsigned long tce_alloc_start, tce_alloc_end;
 #endif
 
-/* export that to outside world */
-struct device_node *of_chosen;
-
 static int __init early_parse_mem(char *p)
 {
 	if (!p)
drivers/of/base.c +1 -0
index 873479a..cb96888 100644
@@ -23,6 +23,7 @@
 #include <linux/proc_fs.h>
 
 struct device_node *allnodes;
+struct device_node *of_chosen;
 
 /* use when traversing tree through the allnext, child, sibling,
  * or parent members of struct device_node.
include/linux/of.h +1 -1
index 5cd2840..d34cc5d 100644
@@ -66,6 +66,7 @@ struct device_node {
 
 /* Pointer for first entry in chain of all nodes. */
 extern struct device_node *allnodes;
+extern struct device_node *of_chosen;
 
 static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
 {
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#24 lore raw

PATCH 7/9 of: move definition of of_chosen into common code.

In reply to Grant Likely

Rather than defining of_chosen in each arch, it can be defined for all in driver/of/base.c

---

 arch/microblaze/include/asm/prom.h |    2 --
 arch/microblaze/kernel/prom.c      |    3 ---
 arch/powerpc/include/asm/prom.h    |    2 --
 arch/powerpc/kernel/prom.c         |    3 ---
 drivers/of/base.c                  |    1 +
 include/linux/of.h                 |    1 +
 6 files changed, 2 insertions(+), 10 deletions(-)
arch/microblaze/include/asm/prom.h +0 -2
index 8b1ebd3..aa1a437 100644
@@ -26,8 +26,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-extern struct device_node *of_chosen;
-
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
 /* Other Prototypes */
arch/microblaze/kernel/prom.c +0 -3
index a7dcaf0..a15ef6d 100644
@@ -42,9 +42,6 @@
 #include <asm/sections.h>
 #include <asm/pci-bridge.h>
 
-/* export that to outside world */
-struct device_node *of_chosen;
-
 void __init early_init_dt_scan_chosen_arch(unsigned long node)
 {
 	/* No Microblaze specific code here */
arch/powerpc/include/asm/prom.h +0 -2
index 4a5070e..7f9a50a 100644
@@ -23,8 +23,6 @@
 #include <asm/irq.h>
 #include <asm/atomic.h>
 
-extern struct device_node *of_chosen;
-
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
 #ifdef CONFIG_PPC32
arch/powerpc/kernel/prom.c +0 -3
index 4869c93..43238b2 100644
@@ -67,9 +67,6 @@ int __initdata iommu_force_on;
 unsigned long tce_alloc_start, tce_alloc_end;
 #endif
 
-/* export that to outside world */
-struct device_node *of_chosen;
-
 static int __init early_parse_mem(char *p)
 {
 	if (!p)
drivers/of/base.c +1 -0
index 873479a..cb96888 100644
@@ -23,6 +23,7 @@
 #include <linux/proc_fs.h>
 
 struct device_node *allnodes;
+struct device_node *of_chosen;
 
 /* use when traversing tree through the allnext, child, sibling,
  * or parent members of struct device_node.
include/linux/of.h +1 -0
index 5cd2840..d34cc5d 100644
@@ -66,6 +66,7 @@ struct device_node {
 
 /* Pointer for first entry in chain of all nodes. */
 extern struct device_node *allnodes;
+extern struct device_node *of_chosen;
 
 static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
 {
#25 lore raw

PATCH 8/9 of/sparc: Remove sparc-local declaration of allnodes and devtree_lock

In reply to Grant Likely

Both allnodes and devtree_lock are defined in common code. The extern declaration should be in the common header too so that the compiler can type check. allnodes is already in of.h, but devtree_lock should be declared there too.

This patch removes the SPARC declarations and uses decls in of.h instead.

---

 arch/sparc/kernel/prom.h |    3 ---
 include/linux/of.h       |    2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)
arch/sparc/kernel/prom.h +0 -3
index 453397f..a8591ef 100644
@@ -4,9 +4,6 @@
 #include <linux/spinlock.h>
 #include <asm/prom.h>
 
-extern struct device_node *allnodes;	/* temporary while merging */
-extern rwlock_t devtree_lock;	/* temporary while merging */
-
 extern void * prom_early_alloc(unsigned long size);
 extern void irq_trans_init(struct device_node *dp);
 
include/linux/of.h +2 -0
index d34cc5d..f6d9cbc 100644
@@ -19,6 +19,7 @@
 #include <linux/bitops.h>
 #include <linux/kref.h>
 #include <linux/mod_devicetable.h>
+#include <linux/spinlock.h>
 
 #include <asm/byteorder.h>
 
@@ -67,6 +68,7 @@ struct device_node {
 /* Pointer for first entry in chain of all nodes. */
 extern struct device_node *allnodes;
 extern struct device_node *of_chosen;
+extern rwlock_t devtree_lock;
 
 static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
 {
Acked-by on v1 8/9
#26 lore raw

Re: [PATCH 8/9] of/sparc: Remove sparc-local declaration of allnodes and devtree_lock

Quoted 8 lines · Grant Likely

Both allnodes and devtree_lock are defined in common code. The extern declaration should be in the common header too so that the compiler can type check. allnodes is already in of.h, but devtree_lock should be declared there too.

This patch removes the SPARC declarations and uses decls in of.h instead.

Quoted 46 lines

---

 arch/sparc/kernel/prom.h |    3 ---
 include/linux/of.h       |    2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)
arch/sparc/kernel/prom.h +0 -3
index 453397f..a8591ef 100644
@@ -4,9 +4,6 @@
 #include <linux/spinlock.h>
 #include <asm/prom.h>
 
-extern struct device_node *allnodes;	/* temporary while merging */
-extern rwlock_t devtree_lock;	/* temporary while merging */
-
 extern void * prom_early_alloc(unsigned long size);
 extern void irq_trans_init(struct device_node *dp);
 
include/linux/of.h +2 -1
index d34cc5d..f6d9cbc 100644
@@ -19,6 +19,7 @@
 #include <linux/bitops.h>
 #include <linux/kref.h>
 #include <linux/mod_devicetable.h>
+#include <linux/spinlock.h>
 
 #include <asm/byteorder.h>
 
@@ -67,6 +68,7 @@ struct device_node {
 /* Pointer for first entry in chain of all nodes. */
 extern struct device_node *allnodes;
 extern struct device_node *of_chosen;
+extern rwlock_t devtree_lock;
 
 static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
 {
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

maintainer Acked-by on v1 8/9
#27 lore raw

Re: [PATCH 8/9] of/sparc: Remove sparc-local declaration of allnodes and devtree_lock

In reply to Grant Likely

From: Grant Likely <[email protected]>
Date: Sat, 13 Feb 2010 09:03:09 -0700

Quoted 8 lines

Both allnodes and devtree_lock are defined in common code. The extern declaration should be in the common header too so that the compiler can type check. allnodes is already in of.h, but devtree_lock should be declared there too.

This patch removes the SPARC declarations and uses decls in of.h instead.

#28 lore raw

PATCH 8/9 of/sparc: Remove sparc-local declaration of allnodes and devtree_lock

In reply to Grant Likely

Both allnodes and devtree_lock are defined in common code. The extern declaration should be in the common header too so that the compiler can type check. allnodes is already in of.h, but devtree_lock should be declared there too.

This patch removes the SPARC declarations and uses decls in of.h instead.

---

 arch/sparc/kernel/prom.h |    3 ---
 include/linux/of.h       |    2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)
arch/sparc/kernel/prom.h +0 -3
index 453397f..a8591ef 100644
@@ -4,9 +4,6 @@
 #include <linux/spinlock.h>
 #include <asm/prom.h>
 
-extern struct device_node *allnodes;	/* temporary while merging */
-extern rwlock_t devtree_lock;	/* temporary while merging */
-
 extern void * prom_early_alloc(unsigned long size);
 extern void irq_trans_init(struct device_node *dp);
 
include/linux/of.h +2 -0
index d34cc5d..f6d9cbc 100644
@@ -19,6 +19,7 @@
 #include <linux/bitops.h>
 #include <linux/kref.h>
 #include <linux/mod_devicetable.h>
+#include <linux/spinlock.h>
 
 #include <asm/byteorder.h>
 
@@ -67,6 +68,7 @@ struct device_node {
 /* Pointer for first entry in chain of all nodes. */
 extern struct device_node *allnodes;
 extern struct device_node *of_chosen;
+extern rwlock_t devtree_lock;
 
 static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
 {
#29 lore raw

PATCH 9/9 of: remove undefined request_OF_resource & release_OF_resource

In reply to Grant Likely

Neither request_OF_resource or release_OF_resource are defined anywhere. Remove the declarations.

---

 arch/microblaze/include/asm/prom.h |    4 ----
 arch/powerpc/include/asm/prom.h    |    5 -----
 2 files changed, 0 insertions(+), 9 deletions(-)
arch/microblaze/include/asm/prom.h +0 -4
index aa1a437..03f45a9 100644
@@ -31,10 +31,6 @@
 /* Other Prototypes */
 extern int early_uartlite_console(void);
 
-extern struct resource *request_OF_resource(struct device_node *node,
-				int index, const char *name_postfix);
-extern int release_OF_resource(struct device_node *node, int index);
-
 /*
  * OF address retreival & translation
  */
arch/powerpc/include/asm/prom.h +0 -5
index 7f9a50a..ddd408a 100644
@@ -39,11 +39,6 @@ extern struct device_node* pci_device_to_OF_node(struct pci_dev *);
 extern void pci_create_OF_bus_map(void);
 #endif
 
-extern struct resource *request_OF_resource(struct device_node* node,
-				int index, const char* name_postfix);
-extern int release_OF_resource(struct device_node* node, int index);
-
-
 /*
  * OF address retreival & translation
  */
Acked-by on v1 9/9
#30 lore raw

Re: [PATCH 9/9] of: remove undefined request_OF_resource & release_OF_resource

Quoted 5 lines · Grant Likely

Neither request_OF_resource or release_OF_resource are defined anywhere. Remove the declarations.

---

Quoted 41 lines
 arch/microblaze/include/asm/prom.h |    4 ----
 arch/powerpc/include/asm/prom.h    |    5 -----
 2 files changed, 0 insertions(+), 9 deletions(-)
arch/microblaze/include/asm/prom.h +0 -4
index aa1a437..03f45a9 100644
@@ -31,10 +31,6 @@
 /* Other Prototypes */
 extern int early_uartlite_console(void);
 
-extern struct resource *request_OF_resource(struct device_node *node,
-				int index, const char *name_postfix);
-extern int release_OF_resource(struct device_node *node, int index);
-
 /*
  * OF address retreival & translation
  */
arch/powerpc/include/asm/prom.h +0 -6
index 7f9a50a..ddd408a 100644
@@ -39,11 +39,6 @@ extern struct device_node* pci_device_to_OF_node(struct pci_dev *);
 extern void pci_create_OF_bus_map(void);
 #endif
 
-extern struct resource *request_OF_resource(struct device_node* node,
-				int index, const char* name_postfix);
-extern int release_OF_resource(struct device_node* node, int index);
-
-
 /*
  * OF address retreival & translation
  */
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#31 lore raw

PATCH 9/9 of: remove undefined request_OF_resource & release_OF_resource

In reply to Grant Likely

Neither request_OF_resource or release_OF_resource are defined anywhere. Remove the declarations.

---

 arch/microblaze/include/asm/prom.h |    4 ----
 arch/powerpc/include/asm/prom.h    |    5 -----
 2 files changed, 0 insertions(+), 9 deletions(-)
arch/microblaze/include/asm/prom.h +0 -4
index aa1a437..03f45a9 100644
@@ -31,10 +31,6 @@
 /* Other Prototypes */
 extern int early_uartlite_console(void);
 
-extern struct resource *request_OF_resource(struct device_node *node,
-				int index, const char *name_postfix);
-extern int release_OF_resource(struct device_node *node, int index);
-
 /*
  * OF address retreival & translation
  */
arch/powerpc/include/asm/prom.h +0 -5
index 7f9a50a..ddd408a 100644
@@ -39,11 +39,6 @@ extern struct device_node* pci_device_to_OF_node(struct pci_dev *);
 extern void pci_create_OF_bus_map(void);
 #endif
 
-extern struct resource *request_OF_resource(struct device_node* node,
-				int index, const char* name_postfix);
-extern int release_OF_resource(struct device_node* node, int index);
-
-
 /*
  * OF address retreival & translation
  */
maintainer Acked-by on the v1 series
#32 lore raw
In reply to Grant Likely
Quoted 7 lines · Grant Likely

Here's another batch of cleanup patches from my test-devicetree branch. A number of cleanups, corrections and minor merges of common code. Also a patch from Jeremy to make the flat tree work on architectures without LMB (arm).

Once I've collected acks on these, I'll move them over to my next-devicetree branch on git://git.secretlab.ca/git/linux-2.6

All changes look ok. Please add them to linux-next which I am testing. I don't expect any problem with it but anywya if any problems arise, I will let you know.

I don't want to reply every email as Ben that's why one my big ACK for that 9 patches.

Quoted 36 lines

Cheers,
g.

---

Grant Likely (6):
of: remove undefined request_OF_resource & release_OF_resource of/sparc: Remove sparc-local declaration of allnodes and devtree_lock
of: move definition of of_chosen into common code.
of: remove unused extern reference to devtree_lock
of: put default string compare and #a/s-cell values into common header
of: Remove old and misplaced function declarations

Jeremy Kerr (3):
of/flattree: Don't assume HAVE_LMB
of: protect linux/of.h with CONFIG_OF
proc_devtree: fix THIS_MODULE without module.h

 arch/microblaze/include/asm/prom.h |   15 ---------------
 arch/microblaze/kernel/prom.c      |    8 +++++---
 arch/powerpc/include/asm/prom.h    |   14 --------------
 arch/powerpc/kernel/prom.c         |   10 +++++-----
 arch/sparc/kernel/prom.h           |    3 ---
 drivers/of/base.c                  |    1 +
 drivers/of/fdt.c                   |    9 ++++++---
 fs/proc/proc_devtree.c             |    1 +
 include/linux/of.h                 |   27 +++++++++++++++++++++++++++
 include/linux/of_fdt.h             |   11 +----------
 10 files changed, 46 insertions(+), 53 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian