[PATCH] of: fdt: add stub for early_init_dt_scan()

Randy Dunlap posted 1 patch 3 years, 6 months ago
include/linux/of_fdt.h |    1 +
1 file changed, 1 insertion(+)
[PATCH] of: fdt: add stub for early_init_dt_scan()
Posted by Randy Dunlap 3 years, 6 months ago
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 add a stub for
this function.

../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: 7480e0aabd5f ("sh: add device tree support and generic board using device tree")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: 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: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/of_fdt.h |    1 +
 1 file changed, 1 insertion(+)

--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -85,6 +85,7 @@ extern void early_init_devtree(void *);
 extern void early_get_first_memblock_info(void *, phys_addr_t *);
 #else /* CONFIG_OF_EARLY_FLATTREE */
 static inline void early_init_dt_check_for_usable_mem_range(void) {}
+static inline bool early_init_dt_scan(void *params) { return false; }
 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) {}
Re: [PATCH] of: fdt: add stub for early_init_dt_scan()
Posted by Rob Herring 3 years, 6 months ago
On Wed, Oct 05, 2022 at 08:11:16PM -0700, Randy Dunlap wrote:
> 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 add a stub for
> this function.
> 
> ../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)) {

I think that sh_fdt_init() needs to be enclosed in 
CONFIG_OF_EARLY_FLATTREE instead of CONFIG_OF_FLATTREE.

> 
> Fixes: 7480e0aabd5f ("sh: add device tree support and generic board using device tree")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: 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: Arnd Bergmann <arnd@arndb.de>
> ---
>  include/linux/of_fdt.h |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -85,6 +85,7 @@ extern void early_init_devtree(void *);
>  extern void early_get_first_memblock_info(void *, phys_addr_t *);
>  #else /* CONFIG_OF_EARLY_FLATTREE */
>  static inline void early_init_dt_check_for_usable_mem_range(void) {}
> +static inline bool early_init_dt_scan(void *params) { return false; }
>  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) {}
>
Re: [PATCH] of: fdt: add stub for early_init_dt_scan()
Posted by Randy Dunlap 3 years, 6 months ago

On 10/6/22 12:38, Rob Herring wrote:
> On Wed, Oct 05, 2022 at 08:11:16PM -0700, Randy Dunlap wrote:
>> 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 add a stub for
>> this function.
>>
>> ../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)) {
> 
> I think that sh_fdt_init() needs to be enclosed in 
> CONFIG_OF_EARLY_FLATTREE instead of CONFIG_OF_FLATTREE.
> 

OK, I'll try that. Thanks.

>>
>> Fixes: 7480e0aabd5f ("sh: add device tree support and generic board using device tree")
>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>> Cc: 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: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  include/linux/of_fdt.h |    1 +
>>  1 file changed, 1 insertion(+)
>>
>> --- a/include/linux/of_fdt.h
>> +++ b/include/linux/of_fdt.h
>> @@ -85,6 +85,7 @@ extern void early_init_devtree(void *);
>>  extern void early_get_first_memblock_info(void *, phys_addr_t *);
>>  #else /* CONFIG_OF_EARLY_FLATTREE */
>>  static inline void early_init_dt_check_for_usable_mem_range(void) {}
>> +static inline bool early_init_dt_scan(void *params) { return false; }
>>  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) {}
>>

-- 
~Randy