devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of/fdt: Fix #ifdef dependency of early flattree declarations
@ 2018-01-02 10:18 Geert Uytterhoeven
  2018-01-03 21:41 ` Rob Herring
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2018-01-02 10:18 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!).
---
 include/linux/of_fdt.h | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 013c5418aeecfdbd..d81a26df46bb6250 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -47,6 +47,13 @@ extern void *initial_boot_params;
 extern char __dtb_start[];
 extern char __dtb_end[];
 
+/* Other Prototypes */
+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);
+
+#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),
@@ -95,17 +102,14 @@ extern const void *of_flat_dt_match_machine(const void *default_match,
 /* Other Prototypes */
 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_EARLY_FLATTREE */
 #endif /* CONFIG_OF_FLATTREE */
 
 #endif /* __ASSEMBLY__ */
-- 
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] 6+ messages in thread

* Re: [PATCH] of/fdt: Fix #ifdef dependency of early flattree declarations
  2018-01-02 10:18 [PATCH] of/fdt: Fix #ifdef dependency of early flattree declarations Geert Uytterhoeven
@ 2018-01-03 21:41 ` Rob Herring
  2018-01-04  8:47   ` Geert Uytterhoeven
  2018-01-03 23:16 ` kbuild test robot
       [not found] ` <1514888297-10791-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
  2 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2018-01-03 21:41 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Frank Rowand, Pantelis Antoniou, devicetree, linux-kernel

On Tue, Jan 02, 2018 at 11:18:17AM +0100, Geert Uytterhoeven 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@glider.be>
> ---
> Seen after forcing OF_FLATTREE=y on sparc64 allmodconfig
> (Hi, out-of-tree OF_CONFIGFS!).

Humm, making FDT actually work with a PDT based system is probably more 
work...

Then again, I guess it could be completely independent like DT overlays 
on an ACPI system. Though that needs some work too to actually be 
useful. Primarily, how to anchor overlays to devices on discoverable 
buses (or discovered by a mechanism other than FDT). 

> ---
>  include/linux/of_fdt.h | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 013c5418aeecfdbd..d81a26df46bb6250 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -47,6 +47,13 @@ extern void *initial_boot_params;
>  extern char __dtb_start[];
>  extern char __dtb_end[];
>  
> +/* Other Prototypes */
> +extern void early_init_devtree(void *);
> +extern void early_get_first_memblock_info(void *, phys_addr_t *);

Seems like these 2 should be in the ifdef?

> +extern u64 of_flat_dt_translate_address(unsigned long node);
> +extern void of_fdt_limit_memory(int limit);
> +
> +#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),
> @@ -95,17 +102,14 @@ extern const void *of_flat_dt_match_machine(const void *default_match,
>  /* Other Prototypes */
>  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_EARLY_FLATTREE */
>  #endif /* CONFIG_OF_FLATTREE */
>  
>  #endif /* __ASSEMBLY__ */
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] of/fdt: Fix #ifdef dependency of early flattree declarations
  2018-01-02 10:18 [PATCH] of/fdt: Fix #ifdef dependency of early flattree declarations Geert Uytterhoeven
  2018-01-03 21:41 ` Rob Herring
@ 2018-01-03 23:16 ` kbuild test robot
       [not found]   ` <201801040759.rKYq0B7R%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
       [not found] ` <1514888297-10791-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
  2 siblings, 1 reply; 6+ messages in thread
From: kbuild test robot @ 2018-01-03 23:16 UTC (permalink / raw)
  Cc: kbuild-all, Rob Herring, Frank Rowand, Pantelis Antoniou,
	devicetree, linux-kernel, Geert Uytterhoeven

[-- Attachment #1: Type: text/plain, Size: 3296 bytes --]

Hi Geert,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.15-rc6 next-20180103]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/of-fdt-Fix-ifdef-dependency-of-early-flattree-declarations/20180104-062259
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: i386-randconfig-i0-201800 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/tty/serial/earlycon.c: In function 'param_setup_earlycon':
>> drivers/tty/serial/earlycon.c:221:11: error: implicit declaration of function 'early_init_dt_scan_chosen_stdout' [-Werror=implicit-function-declaration]
       return early_init_dt_scan_chosen_stdout();
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/early_init_dt_scan_chosen_stdout +221 drivers/tty/serial/earlycon.c

ad1696f6f Aleksey Makarov 2016-09-27  206  
470ca0de6 Peter Hurley    2015-03-09  207  /* early_param wrapper for setup_earlycon() */
470ca0de6 Peter Hurley    2015-03-09  208  static int __init param_setup_earlycon(char *buf)
470ca0de6 Peter Hurley    2015-03-09  209  {
470ca0de6 Peter Hurley    2015-03-09  210  	int err;
470ca0de6 Peter Hurley    2015-03-09  211  
470ca0de6 Peter Hurley    2015-03-09  212  	/*
470ca0de6 Peter Hurley    2015-03-09  213  	 * Just 'earlycon' is a valid param for devicetree earlycons;
470ca0de6 Peter Hurley    2015-03-09  214  	 * don't generate a warning from parse_early_params() in that case
470ca0de6 Peter Hurley    2015-03-09  215  	 */
ad1696f6f Aleksey Makarov 2016-09-27  216  	if (!buf || !buf[0]) {
ad1696f6f Aleksey Makarov 2016-09-27  217  		if (IS_ENABLED(CONFIG_ACPI_SPCR_TABLE)) {
ad1696f6f Aleksey Makarov 2016-09-27  218  			earlycon_init_is_deferred = true;
ad1696f6f Aleksey Makarov 2016-09-27  219  			return 0;
447ef990a Jeffy Chen      2017-08-19  220  		} else if (!buf) {
d503187b6 Leif Lindholm   2016-09-27 @221  			return early_init_dt_scan_chosen_stdout();
ad1696f6f Aleksey Makarov 2016-09-27  222  		}
ad1696f6f Aleksey Makarov 2016-09-27  223  	}
470ca0de6 Peter Hurley    2015-03-09  224  
470ca0de6 Peter Hurley    2015-03-09  225  	err = setup_earlycon(buf);
66c53aaa9 Peter Hurley    2015-05-07  226  	if (err == -ENOENT || err == -EALREADY)
66c53aaa9 Peter Hurley    2015-05-07  227  		return 0;
470ca0de6 Peter Hurley    2015-03-09  228  	return err;
7c53cb3de Peter Hurley    2015-03-09  229  }
470ca0de6 Peter Hurley    2015-03-09  230  early_param("earlycon", param_setup_earlycon);
7c53cb3de Peter Hurley    2015-03-09  231  

:::::: The code at line 221 was first introduced by commit
:::::: d503187b6cc4e41c21c02e695e0e7b5acdd066de of/serial: move earlycon early_param handling to serial

:::::: TO: Leif Lindholm <leif.lindholm@linaro.org>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27473 bytes --]

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

* Re: [PATCH] of/fdt: Fix #ifdef dependency of early flattree declarations
       [not found] ` <1514888297-10791-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
@ 2018-01-04  1:15   ` kbuild test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2018-01-04  1:15 UTC (permalink / raw)
  Cc: kbuild-all-JC7UmRfGjtg, Rob Herring, Frank Rowand,
	Pantelis Antoniou, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven

[-- Attachment #1: Type: text/plain, Size: 7932 bytes --]

Hi Geert,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.15-rc6 next-20180103]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/of-fdt-Fix-ifdef-dependency-of-early-flattree-declarations/20180104-062259
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: cris-etrax-100lx_v2_defconfig (attached as .config)
compiler: cris-linux-gcc (GCC) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=cris 

All errors (new ones prefixed by >>):

   arch/cris/kernel/setup.c: In function 'setup_arch':
>> arch/cris/kernel/setup.c:151:2: error: implicit declaration of function 'unflatten_and_copy_device_tree' [-Werror=implicit-function-declaration]
     unflatten_and_copy_device_tree();
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/unflatten_and_copy_device_tree +151 arch/cris/kernel/setup.c

a9f75ac5 Rabin Vincent  2015-02-08   73  
^1da177e Linus Torvalds 2005-04-16   74  	/* register an initial console printing routine for printk's */
^1da177e Linus Torvalds 2005-04-16   75  
^1da177e Linus Torvalds 2005-04-16   76  	init_etrax_debug();
^1da177e Linus Torvalds 2005-04-16   77  
^1da177e Linus Torvalds 2005-04-16   78  	/* we should really poll for DRAM size! */
^1da177e Linus Torvalds 2005-04-16   79  
^1da177e Linus Torvalds 2005-04-16   80  	high_memory = &dram_end;
^1da177e Linus Torvalds 2005-04-16   81  
^1da177e Linus Torvalds 2005-04-16   82  	if(romfs_in_flash || !romfs_length) {
^1da177e Linus Torvalds 2005-04-16   83  		/* if we have the romfs in flash, or if there is no rom filesystem,
^1da177e Linus Torvalds 2005-04-16   84  		 * our free area starts directly after the BSS
^1da177e Linus Torvalds 2005-04-16   85  		 */
^1da177e Linus Torvalds 2005-04-16   86  		memory_start = (unsigned long) &_end;
^1da177e Linus Torvalds 2005-04-16   87  	} else {
^1da177e Linus Torvalds 2005-04-16   88  		/* otherwise the free area starts after the ROM filesystem */
^1da177e Linus Torvalds 2005-04-16   89  		printk("ROM fs in RAM, size %lu bytes\n", romfs_length);
^1da177e Linus Torvalds 2005-04-16   90  		memory_start = romfs_start + romfs_length;
^1da177e Linus Torvalds 2005-04-16   91  	}
^1da177e Linus Torvalds 2005-04-16   92  
^1da177e Linus Torvalds 2005-04-16   93  	/* process 1's initial memory region is the kernel code/data */
^1da177e Linus Torvalds 2005-04-16   94  
^1da177e Linus Torvalds 2005-04-16   95  	init_mm.start_code = (unsigned long) &text_start;
^1da177e Linus Torvalds 2005-04-16   96  	init_mm.end_code =   (unsigned long) &_etext;
^1da177e Linus Torvalds 2005-04-16   97  	init_mm.end_data =   (unsigned long) &_edata;
^1da177e Linus Torvalds 2005-04-16   98  	init_mm.brk =        (unsigned long) &_end;
^1da177e Linus Torvalds 2005-04-16   99  
^1da177e Linus Torvalds 2005-04-16  100  	/* min_low_pfn points to the start of DRAM, start_pfn points
^1da177e Linus Torvalds 2005-04-16  101  	 * to the first DRAM pages after the kernel, and max_low_pfn
^1da177e Linus Torvalds 2005-04-16  102  	 * to the end of DRAM.
^1da177e Linus Torvalds 2005-04-16  103  	 */
^1da177e Linus Torvalds 2005-04-16  104  
^1da177e Linus Torvalds 2005-04-16  105          /*
^1da177e Linus Torvalds 2005-04-16  106           * partially used pages are not usable - thus
^1da177e Linus Torvalds 2005-04-16  107           * we are rounding upwards:
^1da177e Linus Torvalds 2005-04-16  108           */
^1da177e Linus Torvalds 2005-04-16  109  
^1da177e Linus Torvalds 2005-04-16  110          start_pfn = PFN_UP(memory_start);  /* usually c0000000 + kernel + romfs */
^1da177e Linus Torvalds 2005-04-16  111  	max_pfn =   PFN_DOWN((unsigned long)high_memory); /* usually c0000000 + dram size */
^1da177e Linus Torvalds 2005-04-16  112  
^1da177e Linus Torvalds 2005-04-16  113          /*
^1da177e Linus Torvalds 2005-04-16  114           * Initialize the boot-time allocator (start, end)
^1da177e Linus Torvalds 2005-04-16  115  	 *
^1da177e Linus Torvalds 2005-04-16  116  	 * We give it access to all our DRAM, but we could as well just have
^1da177e Linus Torvalds 2005-04-16  117  	 * given it a small slice. No point in doing that though, unless we
^1da177e Linus Torvalds 2005-04-16  118  	 * have non-contiguous memory and want the boot-stuff to be in, say,
^1da177e Linus Torvalds 2005-04-16  119  	 * the smallest area.
^1da177e Linus Torvalds 2005-04-16  120  	 *
^1da177e Linus Torvalds 2005-04-16  121  	 * It will put a bitmap of the allocated pages in the beginning
^1da177e Linus Torvalds 2005-04-16  122  	 * of the range we give it, but it won't mark the bitmaps pages
^1da177e Linus Torvalds 2005-04-16  123  	 * as reserved. We have to do that ourselves below.
^1da177e Linus Torvalds 2005-04-16  124  	 *
^1da177e Linus Torvalds 2005-04-16  125  	 * We need to use init_bootmem_node instead of init_bootmem
^1da177e Linus Torvalds 2005-04-16  126  	 * because our map starts at a quite high address (min_low_pfn).
^1da177e Linus Torvalds 2005-04-16  127           */
^1da177e Linus Torvalds 2005-04-16  128  
^1da177e Linus Torvalds 2005-04-16  129  	max_low_pfn = max_pfn;
^1da177e Linus Torvalds 2005-04-16  130  	min_low_pfn = PAGE_OFFSET >> PAGE_SHIFT;
^1da177e Linus Torvalds 2005-04-16  131  
^1da177e Linus Torvalds 2005-04-16  132  	bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
^1da177e Linus Torvalds 2005-04-16  133  					 min_low_pfn,
^1da177e Linus Torvalds 2005-04-16  134  					 max_low_pfn);
^1da177e Linus Torvalds 2005-04-16  135  
^1da177e Linus Torvalds 2005-04-16  136  	/* And free all memory not belonging to the kernel (addr, size) */
^1da177e Linus Torvalds 2005-04-16  137  
^1da177e Linus Torvalds 2005-04-16  138  	free_bootmem(PFN_PHYS(start_pfn), PFN_PHYS(max_pfn - start_pfn));
^1da177e Linus Torvalds 2005-04-16  139  
^1da177e Linus Torvalds 2005-04-16  140          /*
^1da177e Linus Torvalds 2005-04-16  141           * Reserve the bootmem bitmap itself as well. We do this in two
^1da177e Linus Torvalds 2005-04-16  142           * steps (first step was init_bootmem()) because this catches
^1da177e Linus Torvalds 2005-04-16  143           * the (very unlikely) case of us accidentally initializing the
^1da177e Linus Torvalds 2005-04-16  144           * bootmem allocator with an invalid RAM area.
^1da177e Linus Torvalds 2005-04-16  145  	 *
^1da177e Linus Torvalds 2005-04-16  146  	 * Arguments are start, size
^1da177e Linus Torvalds 2005-04-16  147           */
^1da177e Linus Torvalds 2005-04-16  148  
72a7fe39 Bernhard Walle 2008-02-07  149  	reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT);
^1da177e Linus Torvalds 2005-04-16  150  
a9f75ac5 Rabin Vincent  2015-02-08 @151  	unflatten_and_copy_device_tree();
a9f75ac5 Rabin Vincent  2015-02-08  152  
^1da177e Linus Torvalds 2005-04-16  153  	/* paging_init() sets up the MMU and marks all pages as reserved */
^1da177e Linus Torvalds 2005-04-16  154  
^1da177e Linus Torvalds 2005-04-16  155  	paging_init();
^1da177e Linus Torvalds 2005-04-16  156  
7cf32cad Mikael Starvik 2005-07-27  157  	*cmdline_p = cris_command_line;
^1da177e Linus Torvalds 2005-04-16  158  

:::::: The code at line 151 was first introduced by commit
:::::: a9f75ac5a24cb94c2373daa3d73f90d22cf5d94b CRISv32: add device tree support

:::::: TO: Rabin Vincent <rabin-66gdRtMMWGc@public.gmane.org>
:::::: CC: Jesper Nilsson <jespern-VrBV9hrLPhE@public.gmane.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 9096 bytes --]

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

* Re: [PATCH] of/fdt: Fix #ifdef dependency of early flattree declarations
       [not found]   ` <201801040759.rKYq0B7R%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2018-01-04  8:33     ` Geert Uytterhoeven
  0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2018-01-04  8:33 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Geert Uytterhoeven, kbuild-all-JC7UmRfGjtg, Rob Herring,
	Frank Rowand, Pantelis Antoniou,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Linux Kernel Mailing List

Hi Fengguang,

On Thu, Jan 4, 2018 at 12:16 AM, kbuild test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> I love your patch! Yet something to improve:

Thanks, I love your report!

> url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/of-fdt-Fix-ifdef-dependency-of-early-flattree-declarations/20180104-062259
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
> config: i386-randconfig-i0-201800 (attached as .config)
> compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386
>
> All errors (new ones prefixed by >>):
>
>    drivers/tty/serial/earlycon.c: In function 'param_setup_earlycon':
>>> drivers/tty/serial/earlycon.c:221:11: error: implicit declaration of function 'early_init_dt_scan_chosen_stdout' [-Werror=implicit-function-declaration]
>        return early_init_dt_scan_chosen_stdout();
>               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    cc1: some warnings being treated as errors

Bummer, of course the dummies should be provided based on complementary
logic... Will fix in v2.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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
--
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] 6+ messages in thread

* Re: [PATCH] of/fdt: Fix #ifdef dependency of early flattree declarations
  2018-01-03 21:41 ` Rob Herring
@ 2018-01-04  8:47   ` Geert Uytterhoeven
  0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2018-01-04  8:47 UTC (permalink / raw)
  To: Rob Herring
  Cc: Geert Uytterhoeven, Frank Rowand, Pantelis Antoniou,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Linux Kernel Mailing List

Hi Rob,

On Wed, Jan 3, 2018 at 10:41 PM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Tue, Jan 02, 2018 at 11:18:17AM +0100, Geert Uytterhoeven 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!).
>
> Humm, making FDT actually work with a PDT based system is probably more
> work...
>
> Then again, I guess it could be completely independent like DT overlays
> on an ACPI system. Though that needs some work too to actually be
> useful. Primarily, how to anchor overlays to devices on discoverable
> buses (or discovered by a mechanism other than FDT).

Indeed.

>> --- a/include/linux/of_fdt.h
>> +++ b/include/linux/of_fdt.h
>> @@ -47,6 +47,13 @@ extern void *initial_boot_params;
>>  extern char __dtb_start[];
>>  extern char __dtb_end[];
>>
>> +/* Other Prototypes */
>> +extern void early_init_devtree(void *);
>> +extern void early_get_first_memblock_info(void *, phys_addr_t *);
>
> Seems like these 2 should be in the ifdef?

These two are not provided nor used by drivers/of/fdt.c, but by architecture
specific code, so that's why I missed them.
The former is used by microblaze, nios2, openrisc, powerpc, and xtensa only.
The latter is used by powerpc only.

All affected architectures select OF_EARLY_FLATTREE (for xtensa only if
USE_OF).

So it indeed makes sense to move them inside the #ifdef. Will do.

>> +extern u64 of_flat_dt_translate_address(unsigned long node);
>> +extern void of_fdt_limit_memory(int limit);
>> +
>> +#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),
>> @@ -95,17 +102,14 @@ extern const void *of_flat_dt_match_machine(const void *default_match,
>>  /* Other Prototypes */
>>  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_EARLY_FLATTREE */
>>  #endif /* CONFIG_OF_FLATTREE */

As pointed out by 0day, the #ifdef CONFIG_OF_EARLY_FLATTREE should be
outside the #ifdef CONFIG_OF_FLATTREE.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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
--
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] 6+ messages in thread

end of thread, other threads:[~2018-01-04  8:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-02 10:18 [PATCH] of/fdt: Fix #ifdef dependency of early flattree declarations Geert Uytterhoeven
2018-01-03 21:41 ` Rob Herring
2018-01-04  8:47   ` Geert Uytterhoeven
2018-01-03 23:16 ` kbuild test robot
     [not found]   ` <201801040759.rKYq0B7R%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-01-04  8:33     ` Geert Uytterhoeven
     [not found] ` <1514888297-10791-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2018-01-04  1:15   ` kbuild test robot

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).