Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of/fdt: Fix #ifdef dependency of early flattree declarations

If OF_FLATTREE=y, but OF_EARLY_FLATTREE=n:

drivers/tty/serial/earlycon.o: In function `param_setup_earlycon':
earlycon.c:(.init.text+0x3a4): undefined reference to `early_init_dt_scan_chosen_stdout'

Fix this by moving the early flattree forward declarations and dummy
implementations inside an #ifdef CONFIG_OF_EARLY_FLATTREE block.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Rob Herring <robh@kernel.org>

authored by

Geert Uytterhoeven and committed by
Rob Herring
f347c367 33314a13

+8 -4
+8 -4
include/linux/of_fdt.h
··· 47 47 extern char __dtb_start[]; 48 48 extern char __dtb_end[]; 49 49 50 + /* Other Prototypes */ 51 + extern u64 of_flat_dt_translate_address(unsigned long node); 52 + extern void of_fdt_limit_memory(int limit); 53 + #endif /* CONFIG_OF_FLATTREE */ 54 + 55 + #ifdef CONFIG_OF_EARLY_FLATTREE 50 56 /* For scanning the flat device-tree at boot time */ 51 57 extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, 52 58 int depth, void *data), ··· 103 97 extern void unflatten_and_copy_device_tree(void); 104 98 extern void early_init_devtree(void *); 105 99 extern void early_get_first_memblock_info(void *, phys_addr_t *); 106 - extern u64 of_flat_dt_translate_address(unsigned long node); 107 - extern void of_fdt_limit_memory(int limit); 108 - #else /* CONFIG_OF_FLATTREE */ 100 + #else /* CONFIG_OF_EARLY_FLATTREE */ 109 101 static inline int early_init_dt_scan_chosen_stdout(void) { return -ENODEV; } 110 102 static inline void early_init_fdt_scan_reserved_mem(void) {} 111 103 static inline void early_init_fdt_reserve_self(void) {} 112 104 static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } 113 105 static inline void unflatten_device_tree(void) {} 114 106 static inline void unflatten_and_copy_device_tree(void) {} 115 - #endif /* CONFIG_OF_FLATTREE */ 107 + #endif /* CONFIG_OF_EARLY_FLATTREE */ 116 108 117 109 #endif /* __ASSEMBLY__ */ 118 110 #endif /* _LINUX_OF_FDT_H */