Re: [PATCH 11/14] init: consolidate prototypes in linux/init.h

Palmer Dabbelt
2023-06-22T15:02:53Z

On Wed, 17 May 2023 06:10:59 PDT (-0700), arnd@kernel.org wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The init/main.c file contains some extern declarations for functions
> defined in architecture code, and it defines some other functions that
> are called from architecture code with a custom prototype. Both of those
> result in warnings with 'make W=1':
>
> init/calibrate.c:261:37: error: no previous prototype for 'calibrate_delay_is_known' [-Werror=missing-prototypes]
> init/main.c:790:20: error: no previous prototype for 'mem_encrypt_init' [-Werror=missing-prototypes]
> init/main.c:792:20: error: no previous prototype for 'poking_init' [-Werror=missing-prototypes]
> arch/arm64/kernel/irq.c:122:13: error: no previous prototype for 'init_IRQ' [-Werror=missing-prototypes]
> arch/arm64/kernel/time.c:55:13: error: no previous prototype for 'time_init' [-Werror=missing-prototypes]
> arch/x86/kernel/process.c:935:13: error: no previous prototype for 'arch_post_acpi_subsys_init' [-Werror=missing-prototypes]
> init/calibrate.c:261:37: error: no previous prototype for 'calibrate_delay_is_known' [-Werror=missing-prototypes]
> kernel/fork.c:991:20: error: no previous prototype for 'arch_task_cache_init' [-Werror=missing-prototypes]
>
> Add prototypes for all of these in include/linux/init.h or another
> appropriate header, and remove the duplicate declarations from
> architecture specific code.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/arm/include/asm/irq.h | 1 -
> arch/microblaze/include/asm/setup.h | 2 --
> arch/mips/include/asm/irq.h | 1 -
> arch/parisc/kernel/smp.c | 1 -
> arch/powerpc/include/asm/irq.h | 1 -
> arch/riscv/include/asm/irq.h | 2 --
> arch/riscv/include/asm/timex.h | 2 --
> arch/s390/kernel/entry.h | 2 --
> arch/sh/include/asm/irq.h | 1 -
> arch/sh/include/asm/rtc.h | 2 --
> arch/sparc/include/asm/irq_32.h | 1 -
> arch/sparc/include/asm/irq_64.h | 1 -
> arch/sparc/include/asm/timer_64.h | 1 -
> arch/sparc/kernel/kernel.h | 4 ----
> arch/x86/include/asm/irq.h | 2 --
> arch/x86/include/asm/mem_encrypt.h | 3 ---
> arch/x86/include/asm/time.h | 1 -
> arch/x86/include/asm/tsc.h | 1 -
> include/linux/acpi.h | 3 ++-
> include/linux/delay.h | 1 +
> include/linux/init.h | 20 ++++++++++++++++++++
> init/main.c | 18 ------------------
> 22 files changed, 23 insertions(+), 48 deletions(-)

...

> diff --git a/arch/riscv/include/asm/irq.h b/arch/riscv/include/asm/irq.h
> index 43b9ebfbd943..8e10a94430a2 100644
> --- a/arch/riscv/include/asm/irq.h
> +++ b/arch/riscv/include/asm/irq.h
> @@ -16,6 +16,4 @@ void riscv_set_intc_hwnode_fn(struct fwnode_handle *(*fn)(void));
>
> struct fwnode_handle *riscv_get_intc_hwnode(void);
>
> -extern void __init init_IRQ(void);
> -
> #endif /* _ASM_RISCV_IRQ_H */
> diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h
> index d6a7428f6248..a06697846e69 100644
> --- a/arch/riscv/include/asm/timex.h
> +++ b/arch/riscv/include/asm/timex.h
> @@ -88,6 +88,4 @@ static inline int read_current_timer(unsigned long *timer_val)
> return 0;
> }
>
> -extern void time_init(void);
> -
> #endif /* _ASM_RISCV_TIMEX_H */

Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com> # RISC-V
Acked-by: Palmer Dabbelt <palmer@rivosinc.com> # RISC-V

Thanks!