Skip to content

Commit 6cba655

Browse files
rddunlapglaubitz
authored andcommitted
sh: init: use OF_EARLY_FLATTREE for early init
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: 03767da ("sh: fix build regression with CONFIG_OF && !CONFIG_OF_FLATTREE") Fixes: eb6b693 ("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>
1 parent d1155e4 commit 6cba655

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

arch/sh/kernel/head_32.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ ENTRY(_stext)
6464
ldc r0, r6_bank
6565
#endif
6666

67-
#ifdef CONFIG_OF_FLATTREE
67+
#ifdef CONFIG_OF_EARLY_FLATTREE
6868
mov r4, r12 ! Store device tree blob pointer in r12
6969
#endif
7070
@@ -315,7 +315,7 @@ ENTRY(_stext)
315315
10:
316316
#endif
317317

318-
#ifdef CONFIG_OF_FLATTREE
318+
#ifdef CONFIG_OF_EARLY_FLATTREE
319319
mov.l 8f, r0 ! Make flat device tree available early.
320320
jsr @r0
321321
mov r12, r4
@@ -346,7 +346,7 @@ ENTRY(stack_start)
346346
5: .long start_kernel
347347
6: .long cpu_init
348348
7: .long init_thread_union
349-
#if defined(CONFIG_OF_FLATTREE)
349+
#if defined(CONFIG_OF_EARLY_FLATTREE)
350350
8: .long sh_fdt_init
351351
#endif
352352

arch/sh/kernel/setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void __init __weak plat_early_device_setup(void)
244244
{
245245
}
246246

247-
#ifdef CONFIG_OF_FLATTREE
247+
#ifdef CONFIG_OF_EARLY_FLATTREE
248248
void __ref sh_fdt_init(phys_addr_t dt_phys)
249249
{
250250
static int done = 0;
@@ -326,7 +326,7 @@ void __init setup_arch(char **cmdline_p)
326326
/* Let earlyprintk output early console messages */
327327
sh_early_platform_driver_probe("earlyprintk", 1, 1);
328328

329-
#ifdef CONFIG_OF_FLATTREE
329+
#ifdef CONFIG_OF_EARLY_FLATTREE
330330
#ifdef CONFIG_USE_BUILTIN_DTB
331331
unflatten_and_copy_device_tree();
332332
#else

0 commit comments

Comments
 (0)