devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] of/fdt: Fix #ifdef dependency of early flattree declarations
@ 2018-01-04  9:08 Geert Uytterhoeven
       [not found] ` <1515056916-6411-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2018-01-04  9:08 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand, Pantelis Antoniou
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven

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-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
---
Seen after forcing OF_FLATTREE=y on sparc64 allmodconfig
(Hi, out-of-tree OF_CONFIGFS!).

v2:
  - Move "#ifdef CONFIG_OF_EARLY_FLATTREE" section outside "#ifdef
    CONFIG_OF_FLATTREE" section to provide dummies if !OF_FLATTREE,
  - Move architecture-specific early_init_devtree() and
    early_get_first_memblock_info() inside "#ifdef
    CONFIG_OF_EARLY_FLATTREE" section.
---
 include/linux/of_fdt.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 013c5418aeecfdbd..444e6e283828a27e 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -47,6 +47,12 @@ extern void *initial_boot_params;
 extern char __dtb_start[];
 extern char __dtb_end[];
 
+/* Other Prototypes */
+extern u64 of_flat_dt_translate_address(unsigned long node);
+extern void of_fdt_limit_memory(int limit);
+#endif /* CONFIG_OF_FLATTREE */
+
+#ifdef CONFIG_OF_EARLY_FLATTREE
 /* For scanning the flat device-tree at boot time */
 extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
 				     int depth, void *data),
@@ -97,16 +103,14 @@ extern void unflatten_device_tree(void);
 extern void unflatten_and_copy_device_tree(void);
 extern void early_init_devtree(void *);
 extern void early_get_first_memblock_info(void *, phys_addr_t *);
-extern u64 of_flat_dt_translate_address(unsigned long node);
-extern void of_fdt_limit_memory(int limit);
-#else /* CONFIG_OF_FLATTREE */
+#else /* CONFIG_OF_EARLY_FLATTREE */
 static inline int early_init_dt_scan_chosen_stdout(void) { return -ENODEV; }
 static inline void early_init_fdt_scan_reserved_mem(void) {}
 static inline void early_init_fdt_reserve_self(void) {}
 static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
 static inline void unflatten_device_tree(void) {}
 static inline void unflatten_and_copy_device_tree(void) {}
-#endif /* CONFIG_OF_FLATTREE */
+#endif /* CONFIG_OF_EARLY_FLATTREE */
 
 #endif /* __ASSEMBLY__ */
 #endif /* _LINUX_OF_FDT_H */
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] of/fdt: Fix #ifdef dependency of early flattree declarations
       [not found] ` <1515056916-6411-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
@ 2018-01-05 20:26   ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2018-01-05 20:26 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Frank Rowand, Pantelis Antoniou,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, Jan 4, 2018 at 3:08 AM, Geert Uytterhoeven
<geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org> wrote:
> 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-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
> ---
> Seen after forcing OF_FLATTREE=y on sparc64 allmodconfig
> (Hi, out-of-tree OF_CONFIGFS!).
>
> v2:
>   - Move "#ifdef CONFIG_OF_EARLY_FLATTREE" section outside "#ifdef
>     CONFIG_OF_FLATTREE" section to provide dummies if !OF_FLATTREE,
>   - Move architecture-specific early_init_devtree() and
>     early_get_first_memblock_info() inside "#ifdef
>     CONFIG_OF_EARLY_FLATTREE" section.
> ---
>  include/linux/of_fdt.h | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 013c5418aeecfdbd..444e6e283828a27e 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -47,6 +47,12 @@ extern void *initial_boot_params;
>  extern char __dtb_start[];
>  extern char __dtb_end[];
>
> +/* Other Prototypes */
> +extern u64 of_flat_dt_translate_address(unsigned long node);
> +extern void of_fdt_limit_memory(int limit);
> +#endif /* CONFIG_OF_FLATTREE */
> +
> +#ifdef CONFIG_OF_EARLY_FLATTREE
>  /* For scanning the flat device-tree at boot time */
>  extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
>                                      int depth, void *data),
> @@ -97,16 +103,14 @@ extern void unflatten_device_tree(void);
>  extern void unflatten_and_copy_device_tree(void);
>  extern void early_init_devtree(void *);
>  extern void early_get_first_memblock_info(void *, phys_addr_t *);
> -extern u64 of_flat_dt_translate_address(unsigned long node);
> -extern void of_fdt_limit_memory(int limit);
> -#else /* CONFIG_OF_FLATTREE */
> +#else /* CONFIG_OF_EARLY_FLATTREE */
>  static inline int early_init_dt_scan_chosen_stdout(void) { return -ENODEV; }
>  static inline void early_init_fdt_scan_reserved_mem(void) {}
>  static inline void early_init_fdt_reserve_self(void) {}
>  static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
>  static inline void unflatten_device_tree(void) {}
>  static inline void unflatten_and_copy_device_tree(void) {}
> -#endif /* CONFIG_OF_FLATTREE */
> +#endif /* CONFIG_OF_EARLY_FLATTREE */

Really, I think most of these shouldn't need dummy versions as they
are called from DT only code, but I guess we had some need to have
them. Ideally, we'd also remove some of these and avoid any arch
specific code, but looks like most do get used. I do see some further
memblock/bootmem clean-up we can do.

Anyway, it better than it was with your change, so I've applied it.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-05 20:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-04  9:08 [PATCH v2] of/fdt: Fix #ifdef dependency of early flattree declarations Geert Uytterhoeven
     [not found] ` <1515056916-6411-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2018-01-05 20:26   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).