]> git.baikalelectronics.ru Git - kernel.git/commitdiff
sh: init: use OF_EARLY_FLATTREE for early init
authorRandy Dunlap <rdunlap@infradead.org>
Mon, 6 Mar 2023 04:00:33 +0000 (20:00 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:36:01 +0000 (11:36 +0200)
commit 6cba655543c7959f8a6d2979b9d40a6a66b7ed4f upstream.

When CONFIG_OF_EARLY_FLATTREE and CONFIG_SH_DEVICE_TREE are not set,
SH3 build fails with a call to early_init_dt_scan(), so in
arch/sh/kernel/setup.c and arch/sh/kernel/head_32.S, use
CONFIG_OF_EARLY_FLATTREE instead of CONFIG_OF_FLATTREE.

Fixes this build error:
../arch/sh/kernel/setup.c: In function 'sh_fdt_init':
../arch/sh/kernel/setup.c:262:26: error: implicit declaration of function 'early_init_dt_scan' [-Werror=implicit-function-declaration]
  262 |         if (!dt_virt || !early_init_dt_scan(dt_virt)) {

Fixes: 3644c628879d ("sh: fix build regression with CONFIG_OF && !CONFIG_OF_FLATTREE")
Fixes: efb73a599e55 ("sh: fix memory corruption of unflattened device tree")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Suggested-by: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: devicetree@vger.kernel.org
Cc: Rich Felker <dalias@libc.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: linux-sh@vger.kernel.org
Cc: stable@vger.kernel.org
Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: https://lore.kernel.org/r/20230306040037.20350-4-rdunlap@infradead.org
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/sh/kernel/head_32.S
arch/sh/kernel/setup.c

index 4adbd4ade319460674ca1d7a56053c825b883ea3..b603b7968b388f334ca8fdc692fb668c5a60deff 100644 (file)
@@ -64,7 +64,7 @@ ENTRY(_stext)
        ldc     r0, r6_bank
 #endif
 
-#ifdef CONFIG_OF_FLATTREE
+#ifdef CONFIG_OF_EARLY_FLATTREE
        mov     r4, r12         ! Store device tree blob pointer in r12
 #endif
        
@@ -315,7 +315,7 @@ ENTRY(_stext)
 10:            
 #endif
 
-#ifdef CONFIG_OF_FLATTREE
+#ifdef CONFIG_OF_EARLY_FLATTREE
        mov.l   8f, r0          ! Make flat device tree available early.
        jsr     @r0
         mov    r12, r4
@@ -346,7 +346,7 @@ ENTRY(stack_start)
 5:     .long   start_kernel
 6:     .long   cpu_init
 7:     .long   init_thread_union
-#if defined(CONFIG_OF_FLATTREE)
+#if defined(CONFIG_OF_EARLY_FLATTREE)
 8:     .long   sh_fdt_init
 #endif
 
index 2c0e0f37a318d3ad6f2628df398bb5d1c54f5f72..c25ee383cb83a40b23f40bd500c116bf3ac34011 100644 (file)
@@ -243,7 +243,7 @@ void __init __weak plat_early_device_setup(void)
 {
 }
 
-#ifdef CONFIG_OF_FLATTREE
+#ifdef CONFIG_OF_EARLY_FLATTREE
 void __ref sh_fdt_init(phys_addr_t dt_phys)
 {
        static int done = 0;
@@ -330,7 +330,7 @@ void __init setup_arch(char **cmdline_p)
        /* Let earlyprintk output early console messages */
        early_platform_driver_probe("earlyprintk", 1, 1);
 
-#ifdef CONFIG_OF_FLATTREE
+#ifdef CONFIG_OF_EARLY_FLATTREE
 #ifdef CONFIG_USE_BUILTIN_DTB
        unflatten_and_copy_device_tree();
 #else