From: Grant Likely <hidden> Date: 2010-02-13 16:02:36
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(-)
From: Grant Likely <hidden> Date: 2010-02-13 16:02:38
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()
Signed-off-by: Grant Likely <redacted>
---
include/linux/of.h | 8 ++++++++
include/linux/of_fdt.h | 10 ----------
2 files changed, 8 insertions(+), 10 deletions(-)
@@ -180,6 +180,14 @@ extern int of_parse_phandles_with_args(struct device_node *np,constchar*list_name,constchar*cells_name,intindex,structdevice_node**out_node,constvoid**out_args);+externintof_machine_is_compatible(constchar*compat);++externintprom_add_property(structdevice_node*np,structproperty*prop);+externintprom_remove_property(structdevice_node*np,structproperty*prop);+externintprom_update_property(structdevice_node*np,+structproperty*newprop,+structproperty*oldprop);+#if defined(CONFIG_OF_DYNAMIC)/* For updating the device tree at runtime */externvoidof_attach_node(structdevice_node*);
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2010-02-14 06:10:12
On Sat, 2010-02-13 at 09:02 -0700, Grant Likely wrote:
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()
Signed-off-by: Grant Likely <redacted>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
@@ -180,6 +180,14 @@ extern int of_parse_phandles_with_args(struct device_node *np,constchar*list_name,constchar*cells_name,intindex,structdevice_node**out_node,constvoid**out_args);+externintof_machine_is_compatible(constchar*compat);++externintprom_add_property(structdevice_node*np,structproperty*prop);+externintprom_remove_property(structdevice_node*np,structproperty*prop);+externintprom_update_property(structdevice_node*np,+structproperty*newprop,+structproperty*oldprop);+#if defined(CONFIG_OF_DYNAMIC)/* For updating the device tree at runtime */externvoidof_attach_node(structdevice_node*);
From: Grant Likely <hidden> Date: 2010-02-13 16:02:54
From: Jeremy Kerr <redacted>
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.
Signed-off-by: Jeremy Kerr <redacted>
Signed-off-by: Grant Likely <redacted>
---
fs/proc/proc_devtree.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2010-02-14 06:10:21
On Sat, 2010-02-13 at 09:02 -0700, Grant Likely wrote:
From: Jeremy Kerr <redacted>
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.
Signed-off-by: Jeremy Kerr <redacted>
Signed-off-by: Grant Likely <redacted>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
From: Grant Likely <hidden> Date: 2010-02-13 16:02:57
From: Jeremy Kerr <redacted>
For platforms that have CONFIG_OF optional, we need to make the contents
of linux/of.h conditional on CONFIG_OF.
Signed-off-by: Jeremy Kerr <redacted>
Signed-off-by: Grant Likely <redacted>
---
include/linux/of.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2010-02-14 06:36:22
On Sat, 2010-02-13 at 09:02 -0700, Grant Likely wrote:
From: Jeremy Kerr <redacted>
For platforms that have CONFIG_OF optional, we need to make the contents
of linux/of.h conditional on CONFIG_OF.
Signed-off-by: Jeremy Kerr <redacted>
Signed-off-by: Grant Likely <redacted>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
For now...
In the long run, maybe we want some of the iterators to be empty inlines
returning NULL ?
Cheers,
Ben.
From: Grant Likely <hidden> Date: 2010-02-14 14:06:50
On Sat, Feb 13, 2010 at 11:10 PM, Benjamin Herrenschmidt
[off-list ref] wrote:
On Sat, 2010-02-13 at 09:02 -0700, Grant Likely wrote:
quoted
From: Jeremy Kerr <redacted>
For platforms that have CONFIG_OF optional, we need to make the contents
of linux/of.h conditional on CONFIG_OF.
Signed-off-by: Jeremy Kerr <redacted>
Signed-off-by: Grant Likely <redacted>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
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.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
From: Grant Likely <hidden> Date: 2010-02-13 16:03:14
Rather than defining of_chosen in each arch, it can be defined for all
in driver/of/base.c
Signed-off-by: Grant Likely <redacted>
---
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(-)
@@ -42,9 +42,6 @@#include<asm/sections.h>#include<asm/pci-bridge.h>-/* export that to outside world */-structdevice_node*of_chosen;-void__initearly_init_dt_scan_chosen_arch(unsignedlongnode){/* No Microblaze specific code here */
@@ -67,9 +67,6 @@ int __initdata iommu_force_on;unsignedlongtce_alloc_start,tce_alloc_end;#endif-/* export that to outside world */-structdevice_node*of_chosen;-staticint__initearly_parse_mem(char*p){if(!p)
@@ -23,6 +23,7 @@#include<linux/proc_fs.h>structdevice_node*allnodes;+structdevice_node*of_chosen;/* use when traversing tree through the allnext, child, sibling,*orparentmembersofstructdevice_node.
@@ -66,6 +66,7 @@ struct device_node {/* Pointer for first entry in chain of all nodes. */externstructdevice_node*allnodes;+externstructdevice_node*of_chosen;staticinlineintof_node_check_flag(structdevice_node*n,unsignedlongflag){
@@ -42,9 +42,6 @@#include<asm/sections.h>#include<asm/pci-bridge.h>-/* export that to outside world */-structdevice_node*of_chosen;-void__initearly_init_dt_scan_chosen_arch(unsignedlongnode){/* No Microblaze specific code here */
@@ -67,9 +67,6 @@ int __initdata iommu_force_on;unsignedlongtce_alloc_start,tce_alloc_end;#endif-/* export that to outside world */-structdevice_node*of_chosen;-staticint__initearly_parse_mem(char*p){if(!p)
@@ -23,6 +23,7 @@#include<linux/proc_fs.h>structdevice_node*allnodes;+structdevice_node*of_chosen;/* use when traversing tree through the allnext, child, sibling,*orparentmembersofstructdevice_node.
@@ -66,6 +66,7 @@ struct device_node {/* Pointer for first entry in chain of all nodes. */externstructdevice_node*allnodes;+externstructdevice_node*of_chosen;staticinlineintof_node_check_flag(structdevice_node*n,unsignedlongflag){--
From: Grant Likely <hidden> Date: 2010-02-13 16:03:17
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.
Signed-off-by: Grant Likely <redacted>
---
arch/sparc/kernel/prom.h | 3 ---
include/linux/of.h | 2 ++
2 files changed, 2 insertions(+), 3 deletions(-)
@@ -67,6 +68,7 @@ struct device_node {/* Pointer for first entry in chain of all nodes. */externstructdevice_node*allnodes;externstructdevice_node*of_chosen;+externrwlock_tdevtree_lock;staticinlineintof_node_check_flag(structdevice_node*n,unsignedlongflag){
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2010-02-14 06:13:33
On Sat, 2010-02-13 at 09:03 -0700, Grant Likely wrote:
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.
Signed-off-by: Grant Likely <redacted>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
@@ -67,6 +68,7 @@ struct device_node {/* Pointer for first entry in chain of all nodes. */externstructdevice_node*allnodes;externstructdevice_node*of_chosen;+externrwlock_tdevtree_lock;staticinlineintof_node_check_flag(structdevice_node*n,unsignedlongflag){--
From: David Miller <davem@davemloft.net> Date: 2010-02-14 19:49:56
From: Grant Likely <redacted>
Date: Sat, 13 Feb 2010 09:03:09 -0700
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.
Signed-off-by: Grant Likely <redacted>
From: Grant Likely <hidden> Date: 2010-02-13 16:03:54
From: Jeremy Kerr <redacted>
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.
Signed-off-by: Jeremy Kerr <redacted>
Signed-off-by: Grant Likely <redacted>
---
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(-)
@@ -55,6 +55,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)lmb_add(base,size);}+u64__initearly_init_dt_alloc_memory_arch(u64size,u64align)+{+returnlmb_alloc(size,align);+}+#ifdef CONFIG_EARLY_PRINTK/* MS this is Microblaze specifig function */staticint__initearly_init_dt_scan_serial(unsignedlongnode,
@@ -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__(structdevice_node));+mem=early_init_dt_alloc_memory_arch(size+4,+__alignof__(structdevice_node));mem=(unsignedlong)__va(mem);((__be32*)mem)[size/4]=cpu_to_be32(0xdeadbeef);
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2010-02-14 06:11:47
On Sat, 2010-02-13 at 09:02 -0700, Grant Likely wrote:
From: Jeremy Kerr <redacted>
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.
Signed-off-by: Jeremy Kerr <redacted>
Signed-off-by: Grant Likely <redacted>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
@@ -55,6 +55,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)lmb_add(base,size);}+u64__initearly_init_dt_alloc_memory_arch(u64size,u64align)+{+returnlmb_alloc(size,align);+}+#ifdef CONFIG_EARLY_PRINTK/* MS this is Microblaze specifig function */staticint__initearly_init_dt_scan_serial(unsignedlongnode,
@@ -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__(structdevice_node));+mem=early_init_dt_alloc_memory_arch(size+4,+__alignof__(structdevice_node));mem=(unsignedlong)__va(mem);((__be32*)mem)[size/4]=cpu_to_be32(0xdeadbeef);
From: Michal Simek <hidden> Date: 2010-02-14 14:03:08
Grant Likely wrote:
quoted hunk
From: Jeremy Kerr <redacted>
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.
Signed-off-by: Jeremy Kerr <redacted>
Signed-off-by: Grant Likely <redacted>
---
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(-)
@@ -55,6 +55,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)lmb_add(base,size);}+u64__initearly_init_dt_alloc_memory_arch(u64size,u64align)+{+returnlmb_alloc(size,align);+}+#ifdef CONFIG_EARLY_PRINTK/* MS this is Microblaze specifig function */staticint__initearly_init_dt_scan_serial(unsignedlongnode,
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 hunk
+#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);
--
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
From: Grant Likely <hidden> Date: 2010-02-14 14:09:18
On Sun, Feb 14, 2010 at 7:00 AM, Michal Simek
[off-list ref] wrote:
Grant Likely wrote:
quoted
From: Jeremy Kerr <redacted>
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.
Signed-off-by: Jeremy Kerr <redacted>
Signed-off-by: Grant Likely <redacted>
---
=A0arch/microblaze/kernel/prom.c | =A0 =A05 +++++
=A0arch/powerpc/kernel/prom.c =A0 =A0| =A0 =A05 +++++
=A0drivers/of/fdt.c =A0 =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A09 ++++++---
=A0include/linux/of_fdt.h =A0 =A0 =A0 =A0| =A0 =A01 +
=A04 files changed, 17 insertions(+), 3 deletions(-)
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. :-)
Michal
quoted
=A0+#include <asm/page.h>
+
=A0int __initdata dt_root_addr_cells;
=A0int __initdata dt_root_size_cells;
=A0@@ -560,7 +562,8 @@ void __init unflatten_device_tree(void)
=A0 =A0 =A0 =A0pr_debug(" =A0size is %lx, allocating...\n", size);
=A0 =A0 =A0 =A0 =A0/* Allocate memory for the expanded device tree */
- =A0 =A0 =A0 mem =3D lmb_alloc(size + 4, __alignof__(struct device_node=
--
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
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
From: Grant Likely <hidden> Date: 2010-02-13 16:08:12
Most architectures don't need to change these. Put them into common
code to eliminate some duplication
Signed-off-by: Grant Likely <redacted>
---
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(-)
From: Grant Likely <hidden> Date: 2010-02-13 16:11:10
Neither the powerpc nor the microblaze code use devtree_lock anymore.
Remove the extern reference.
Signed-off-by: Grant Likely <redacted>
---
arch/microblaze/include/asm/prom.h | 2 --
arch/powerpc/kernel/prom.c | 2 --
2 files changed, 0 insertions(+), 4 deletions(-)
@@ -67,8 +67,6 @@ int __initdata iommu_force_on;unsignedlongtce_alloc_start,tce_alloc_end;#endif-externrwlock_tdevtree_lock;/* temporary while merging */-/* export that to outside world */structdevice_node*of_chosen;
@@ -67,8 +67,6 @@ int __initdata iommu_force_on;unsignedlongtce_alloc_start,tce_alloc_end;#endif-externrwlock_tdevtree_lock;/* temporary while merging */-/* export that to outside world */structdevice_node*of_chosen;--
From: Michal Simek <monstr@monstr.eu> Date: 2010-02-14 14:08:51
Grant Likely wrote:
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.
Acked-by: Michal Simek <monstr@monstr.eu>
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 majordomo@vger.kernel.org
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)
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