Discussion:
[ORLinux] [PATCH 13/17] openrisc: Refactor or32_early_setup()
Geert Uytterhoeven
2013-11-12 19:42:23 UTC
Permalink
- Change fdt pointer (passed from head.S) from unsigned int to void *,
which allows to kill a cast, and makes it compatible with __dtb_start.
- Use pr_info(),
- Extract common part.

Signed-off-by: Geert Uytterhoeven <geert at linux-m68k.org>
Cc: Jonas Bonn <jonas at southpole.se>
Cc: linux at lists.openrisc.net
---
arch/openrisc/kernel/setup.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index d0e7693c67a3..4fc7ccc0a2cf 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -208,15 +208,15 @@ void __init setup_cpuinfo(void)
* Falls back on built-in device tree in case null pointer is passed.
*/

-void __init or32_early_setup(unsigned int fdt)
+void __init or32_early_setup(void *fdt)
{
- if (fdt) {
- early_init_devtree((void*) fdt);
- printk(KERN_INFO "FDT at 0x%08x\n", fdt);
- } else {
- early_init_devtree(__dtb_start);
- printk(KERN_INFO "Compiled-in FDT at %p\n", __dtb_start);
+ if (fdt)
+ pr_info("FDT at %p\n", fdt);
+ else {
+ fdt = __dtb_start;
+ pr_info("Compiled-in FDT at %p\n", fdt);
}
+ early_init_devtree(fdt);
}

static int __init openrisc_device_probe(void)
--
1.7.9.5
Geert Uytterhoeven
2013-11-12 19:54:38 UTC
Permalink
On Tue, Nov 12, 2013 at 8:42 PM, Geert Uytterhoeven
This started as a small cleanup in the OpenRISC code, but then I got
pulled into the pool of all section-related symbols, many of which are
different or duplicated.
Bummer, I forgot the two OpenRISC commits that started it all
(too high up in my commit chain). Will send...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
2013-11-12 19:56:20 UTC
Permalink
Openrisc's private vmlinux.h duplicates a few definitions that are already
provided by asm-generic/sections.h. The former is used by setup.c only,
while the latter is already used everywhere else.

Convert setup.c to use the generic version:
- Include <asm/sections.h>,
- Remove the (slightly different) extern declarations,
- Remove the no longer needed address-of ('&') operators.

Signed-off-by: Geert Uytterhoeven <geert at linux-m68k.org>
---
arch/openrisc/kernel/setup.c | 11 ++++++-----
arch/openrisc/kernel/vmlinux.h | 1 -
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index ecc1c8850a11..c9b880d64bb8 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -40,6 +40,7 @@
#include <linux/device.h>
#include <linux/of_platform.h>

+#include <asm/sections.h>
#include <asm/segment.h>
#include <asm/pgtable.h>
#include <asm/types.h>
@@ -75,7 +76,7 @@ static unsigned long __init setup_memory(void)

ram_start_pfn = PFN_UP(memory_start);
/* free_ram_start_pfn is first page after kernel */
- free_ram_start_pfn = PFN_UP(__pa(&_end));
+ free_ram_start_pfn = PFN_UP(__pa(_end));
ram_end_pfn = PFN_DOWN(memblock_end_of_DRAM());

max_pfn = ram_end_pfn;
@@ -288,10 +289,10 @@ void __init setup_arch(char **cmdline_p)
setup_cpuinfo();

/* process 1's initial memory region is the kernel code/data */
- init_mm.start_code = (unsigned long)&_stext;
- init_mm.end_code = (unsigned long)&_etext;
- init_mm.end_data = (unsigned long)&_edata;
- init_mm.brk = (unsigned long)&_end;
+ init_mm.start_code = (unsigned long)_stext;
+ init_mm.end_code = (unsigned long)_etext;
+ init_mm.end_data = (unsigned long)_edata;
+ init_mm.brk = (unsigned long)_end;

#ifdef CONFIG_BLK_DEV_INITRD
initrd_start = (unsigned long)&__initrd_start;
diff --git a/arch/openrisc/kernel/vmlinux.h b/arch/openrisc/kernel/vmlinux.h
index 653728abcc7c..6c0b24772f85 100644
--- a/arch/openrisc/kernel/vmlinux.h
+++ b/arch/openrisc/kernel/vmlinux.h
@@ -1,7 +1,6 @@
#ifndef __OPENRISC_VMLINUX_H_
#define __OPENRISC_VMLINUX_H_

-extern char _stext, _etext, _edata, _end;
#ifdef CONFIG_BLK_DEV_INITRD
extern char __initrd_start, __initrd_end;
extern char __initramfs_start;
--
1.7.9.5
Geert Uytterhoeven
2013-11-12 19:56:21 UTC
Permalink
Signed-off-by: Geert Uytterhoeven <geert at linux-m68k.org>
---
arch/openrisc/kernel/vmlinux.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/arch/openrisc/kernel/vmlinux.h b/arch/openrisc/kernel/vmlinux.h
index 6c0b24772f85..bbcdf21b0b35 100644
--- a/arch/openrisc/kernel/vmlinux.h
+++ b/arch/openrisc/kernel/vmlinux.h
@@ -3,7 +3,6 @@

#ifdef CONFIG_BLK_DEV_INITRD
extern char __initrd_start, __initrd_end;
-extern char __initramfs_start;
#endif

#endif
--
1.7.9.5
Jonas Bonn
2013-11-15 09:59:33 UTC
Permalink
Post by Geert Uytterhoeven
- Change fdt pointer (passed from head.S) from unsigned int to void *,
which allows to kill a cast, and makes it compatible with __dtb_start.
- Use pr_info(),
- Extract common part.
Signed-off-by: Geert Uytterhoeven <geert at linux-m68k.org>
Cc: Jonas Bonn <jonas at southpole.se>
Cc: linux at lists.openrisc.net
Thanks, I'll take this one directly into the OpenRISC tree.

/Jonas

Loading...