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

Merge branch 'asm-generic-prototypes' into asm-generic

As part of my quest to enable -Wmissing-prototypes by default,
these patches clean up some of the prototypes that are needed by all
architectures but are handled inconsistently.

The duplicate prototypes are moved into common code, which helps both
to clean up the existing warnings and simplifies the logic.

* asm-generic-prototypes:
arm64: vdso32: Define BUILD_VDSO32_64 to correct prototypes
csky: fix arch_jump_label_transform_static override
arch: add do_page_fault prototypes
arch: add missing prepare_ftrace_return() prototypes
arch: vdso: consolidate gettime prototypes
arch: include linux/cpu.h for trap_init() prototype
arch: fix asm-offsets.c building with -Wmissing-prototypes
arch: consolidate arch_irq_work_raise prototypes

+85 -72
+2
arch/alpha/include/asm/mmu_context.h
··· 183 183 } 184 184 185 185 extern void __load_new_mm_context(struct mm_struct *); 186 + asmlinkage void do_page_fault(unsigned long address, unsigned long mmcsr, 187 + long cause, struct pt_regs *regs); 186 188 187 189 #ifdef CONFIG_SMP 188 190 #define check_mmu_context() \
+1 -1
arch/alpha/kernel/asm-offsets.c
··· 12 12 #include <linux/kbuild.h> 13 13 #include <asm/io.h> 14 14 15 - void foo(void) 15 + static void __used foo(void) 16 16 { 17 17 DEFINE(TI_TASK, offsetof(struct thread_info, task)); 18 18 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
+1
arch/alpha/kernel/traps.c
··· 9 9 * This file initializes the trap entry points 10 10 */ 11 11 12 + #include <linux/cpu.h> 12 13 #include <linux/jiffies.h> 13 14 #include <linux/mm.h> 14 15 #include <linux/sched/signal.h>
-2
arch/arm/include/asm/irq_work.h
··· 9 9 return is_smp(); 10 10 } 11 11 12 - extern void arch_irq_work_raise(void); 13 - 14 12 #endif /* _ASM_ARM_IRQ_WORK_H */
-5
arch/arm/include/asm/vdso.h
··· 24 24 25 25 #endif /* CONFIG_VDSO */ 26 26 27 - int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts); 28 - int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts); 29 - int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz); 30 - int __vdso_clock_getres(clockid_t clock_id, struct old_timespec32 *res); 31 - 32 27 #endif /* __ASSEMBLY__ */ 33 28 34 29 #endif /* __KERNEL__ */
+1
arch/arm/vdso/vgettimeofday.c
··· 8 8 #include <linux/types.h> 9 9 #include <asm/vdso.h> 10 10 #include <asm/unwind.h> 11 + #include <vdso/gettime.h> 11 12 12 13 int __vdso_clock_gettime(clockid_t clock, 13 14 struct old_timespec32 *ts)
-2
arch/arm64/include/asm/irq_work.h
··· 2 2 #ifndef __ASM_IRQ_WORK_H 3 3 #define __ASM_IRQ_WORK_H 4 4 5 - extern void arch_irq_work_raise(void); 6 - 7 5 static inline bool arch_irq_work_has_interrupt(void) 8 6 { 9 7 return true;
+2
arch/arm64/kernel/vdso32/vgettimeofday.c
··· 5 5 * Copyright (C) 2018 ARM Limited 6 6 * 7 7 */ 8 + #define BUILD_VDSO32_64 9 + #include <vdso/gettime.h> 8 10 9 11 int __vdso_clock_gettime(clockid_t clock, 10 12 struct old_timespec32 *ts)
+4
arch/csky/include/asm/ftrace.h
··· 26 26 27 27 struct dyn_arch_ftrace { 28 28 }; 29 + 30 + void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, 31 + unsigned long frame_pointer); 32 + 29 33 #endif /* !__ASSEMBLY__ */ 30 34 #endif /* __ASM_CSKY_FTRACE_H */
+1 -1
arch/csky/include/asm/irq_work.h
··· 7 7 { 8 8 return true; 9 9 } 10 - extern void arch_irq_work_raise(void); 10 + 11 11 #endif /* __ASM_CSKY_IRQ_WORK_H */
+5
arch/csky/include/asm/jump_label.h
··· 43 43 return true; 44 44 } 45 45 46 + enum jump_label_type; 47 + void arch_jump_label_transform_static(struct jump_entry *entry, 48 + enum jump_label_type type); 49 + #define arch_jump_label_transform_static arch_jump_label_transform_static 50 + 46 51 #endif /* __ASSEMBLY__ */ 47 52 #endif /* __ASM_CSKY_JUMP_LABEL_H */
+1 -1
arch/csky/include/asm/traps.h
··· 55 55 asmlinkage void do_notify_resume(struct pt_regs *regs, 56 56 unsigned long thread_info_flags); 57 57 58 - void trap_init(void); 58 + asmlinkage void do_page_fault(struct pt_regs *regs); 59 59 60 60 #endif /* __ASM_CSKY_TRAPS_H */
+1
arch/csky/kernel/traps.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 3 3 4 + #include <linux/cpu.h> 4 5 #include <linux/sched.h> 5 6 #include <linux/signal.h> 6 7 #include <linux/kernel.h>
+1 -10
arch/csky/kernel/vdso/vgettimeofday.c
··· 2 2 3 3 #include <linux/time.h> 4 4 #include <linux/types.h> 5 + #include <vdso/gettime.h> 5 6 6 7 extern 7 - int __vdso_clock_gettime(clockid_t clock, 8 - struct old_timespec32 *ts); 9 8 int __vdso_clock_gettime(clockid_t clock, 10 9 struct old_timespec32 *ts) 11 10 { ··· 12 13 } 13 14 14 15 int __vdso_clock_gettime64(clockid_t clock, 15 - struct __kernel_timespec *ts); 16 - int __vdso_clock_gettime64(clockid_t clock, 17 16 struct __kernel_timespec *ts) 18 17 { 19 18 return __cvdso_clock_gettime(clock, ts); 20 19 } 21 20 22 - extern 23 - int __vdso_gettimeofday(struct __kernel_old_timeval *tv, 24 - struct timezone *tz); 25 21 int __vdso_gettimeofday(struct __kernel_old_timeval *tv, 26 22 struct timezone *tz) 27 23 { 28 24 return __cvdso_gettimeofday(tv, tz); 29 25 } 30 26 31 - extern 32 - int __vdso_clock_getres(clockid_t clock_id, 33 - struct old_timespec32 *res); 34 27 int __vdso_clock_getres(clockid_t clock_id, 35 28 struct old_timespec32 *res) 36 29 {
+13 -13
arch/loongarch/kernel/asm-offsets.c
··· 15 15 #include <asm/processor.h> 16 16 #include <asm/ftrace.h> 17 17 18 - void output_ptreg_defines(void) 18 + static void __used output_ptreg_defines(void) 19 19 { 20 20 COMMENT("LoongArch pt_regs offsets."); 21 21 OFFSET(PT_R0, pt_regs, regs[0]); ··· 62 62 BLANK(); 63 63 } 64 64 65 - void output_task_defines(void) 65 + static void __used output_task_defines(void) 66 66 { 67 67 COMMENT("LoongArch task_struct offsets."); 68 68 OFFSET(TASK_STATE, task_struct, __state); ··· 77 77 BLANK(); 78 78 } 79 79 80 - void output_thread_info_defines(void) 80 + static void __used output_thread_info_defines(void) 81 81 { 82 82 COMMENT("LoongArch thread_info offsets."); 83 83 OFFSET(TI_TASK, thread_info, task); ··· 93 93 BLANK(); 94 94 } 95 95 96 - void output_thread_defines(void) 96 + static void __used output_thread_defines(void) 97 97 { 98 98 COMMENT("LoongArch specific thread_struct offsets."); 99 99 OFFSET(THREAD_REG01, task_struct, thread.reg01); ··· 129 129 BLANK(); 130 130 } 131 131 132 - void output_thread_fpu_defines(void) 132 + static void __used output_thread_fpu_defines(void) 133 133 { 134 134 OFFSET(THREAD_FPR0, loongarch_fpu, fpr[0]); 135 135 OFFSET(THREAD_FPR1, loongarch_fpu, fpr[1]); ··· 170 170 BLANK(); 171 171 } 172 172 173 - void output_thread_lbt_defines(void) 173 + static void __used output_thread_lbt_defines(void) 174 174 { 175 175 OFFSET(THREAD_SCR0, loongarch_lbt, scr0); 176 176 OFFSET(THREAD_SCR1, loongarch_lbt, scr1); ··· 180 180 BLANK(); 181 181 } 182 182 183 - void output_mm_defines(void) 183 + static void __used output_mm_defines(void) 184 184 { 185 185 COMMENT("Size of struct page"); 186 186 DEFINE(STRUCT_PAGE_SIZE, sizeof(struct page)); ··· 212 212 BLANK(); 213 213 } 214 214 215 - void output_sc_defines(void) 215 + static void __used output_sc_defines(void) 216 216 { 217 217 COMMENT("Linux sigcontext offsets."); 218 218 OFFSET(SC_REGS, sigcontext, sc_regs); ··· 220 220 BLANK(); 221 221 } 222 222 223 - void output_signal_defines(void) 223 + static void __used output_signal_defines(void) 224 224 { 225 225 COMMENT("Linux signal numbers."); 226 226 DEFINE(_SIGHUP, SIGHUP); ··· 258 258 } 259 259 260 260 #ifdef CONFIG_SMP 261 - void output_smpboot_defines(void) 261 + static void __used output_smpboot_defines(void) 262 262 { 263 263 COMMENT("Linux smp cpu boot offsets."); 264 264 OFFSET(CPU_BOOT_STACK, secondary_data, stack); ··· 268 268 #endif 269 269 270 270 #ifdef CONFIG_HIBERNATION 271 - void output_pbe_defines(void) 271 + static void __used output_pbe_defines(void) 272 272 { 273 273 COMMENT("Linux struct pbe offsets."); 274 274 OFFSET(PBE_ADDRESS, pbe, address); ··· 280 280 #endif 281 281 282 282 #ifdef CONFIG_FUNCTION_GRAPH_TRACER 283 - void output_fgraph_ret_regs_defines(void) 283 + static void __used output_fgraph_ret_regs_defines(void) 284 284 { 285 285 COMMENT("LoongArch fgraph_ret_regs offsets."); 286 286 OFFSET(FGRET_REGS_A0, fgraph_ret_regs, regs[0]); ··· 291 291 } 292 292 #endif 293 293 294 - void output_kvm_defines(void) 294 + static void __used output_kvm_defines(void) 295 295 { 296 296 COMMENT("KVM/LoongArch Specific offsets."); 297 297
+1 -6
arch/loongarch/vdso/vgettimeofday.c
··· 5 5 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 6 6 */ 7 7 #include <linux/types.h> 8 + #include <vdso/gettime.h> 8 9 9 - extern 10 - int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts); 11 10 int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts) 12 11 { 13 12 return __cvdso_clock_gettime(clock, ts); 14 13 } 15 14 16 - extern 17 - int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz); 18 15 int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) 19 16 { 20 17 return __cvdso_gettimeofday(tv, tz); 21 18 } 22 19 23 - extern 24 - int __vdso_clock_getres(clockid_t clock_id, struct __kernel_timespec *res); 25 20 int __vdso_clock_getres(clockid_t clock_id, struct __kernel_timespec *res) 26 21 { 27 22 return __cvdso_clock_getres(clock_id, res);
+1 -2
arch/m68k/coldfire/vectors.c
··· 12 12 #include <linux/kernel.h> 13 13 #include <linux/init.h> 14 14 #include <linux/irq.h> 15 + #include <linux/cpu.h> 15 16 #include <asm/traps.h> 16 17 #include <asm/machdep.h> 17 18 #include <asm/coldfire.h> 18 19 #include <asm/mcfsim.h> 19 20 #include <asm/mcfwdebug.h> 20 - 21 - #include "vectors.h" 22 21 23 22 /***************************************************************************/ 24 23
-3
arch/m68k/coldfire/vectors.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - 3 - void trap_init(void);
+1
arch/microblaze/include/asm/ftrace.h
··· 10 10 #ifndef __ASSEMBLY__ 11 11 extern void _mcount(void); 12 12 extern void ftrace_call_graph(void); 13 + void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr); 13 14 #endif 14 15 15 16 #ifdef CONFIG_DYNAMIC_FTRACE
+1
arch/microblaze/kernel/traps.c
··· 8 8 * for more details. 9 9 */ 10 10 11 + #include <linux/cpu.h> 11 12 #include <linux/export.h> 12 13 #include <linux/kernel.h> 13 14 #include <linux/kallsyms.h>
+4
arch/mips/include/asm/ftrace.h
··· 85 85 }; 86 86 87 87 #endif /* CONFIG_DYNAMIC_FTRACE */ 88 + 89 + void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra, 90 + unsigned long fp); 91 + 88 92 #endif /* __ASSEMBLY__ */ 89 93 #endif /* CONFIG_FUNCTION_TRACER */ 90 94 #endif /* _ASM_MIPS_FTRACE_H */
+3
arch/mips/include/asm/traps.h
··· 39 39 register_nmi_notifier(&fn##_nb); \ 40 40 }) 41 41 42 + asmlinkage void do_page_fault(struct pt_regs *regs, 43 + unsigned long write, unsigned long address); 44 + 42 45 #endif /* _ASM_TRAPS_H */
+1
arch/mips/vdso/vgettimeofday.c
··· 9 9 */ 10 10 #include <linux/time.h> 11 11 #include <linux/types.h> 12 + #include <vdso/gettime.h> 12 13 13 14 #if _MIPS_SIM != _MIPS_SIM_ABI64 14 15 int __vdso_clock_gettime(clockid_t clock,
+2
arch/nios2/include/asm/traps.h
··· 14 14 15 15 #ifndef __ASSEMBLY__ 16 16 void _exception(int signo, struct pt_regs *regs, int code, unsigned long addr); 17 + void do_page_fault(struct pt_regs *regs, unsigned long cause, 18 + unsigned long address); 17 19 #endif 18 20 19 21 #endif /* _ASM_NIOS2_TRAPS_H */
-1
arch/powerpc/include/asm/irq_work.h
··· 6 6 { 7 7 return true; 8 8 } 9 - extern void arch_irq_work_raise(void); 10 9 11 10 #endif /* _ASM_POWERPC_IRQ_WORK_H */
+1 -1
arch/riscv/include/asm/irq_work.h
··· 6 6 { 7 7 return IS_ENABLED(CONFIG_SMP); 8 8 } 9 - extern void arch_irq_work_raise(void); 9 + 10 10 #endif /* _ASM_RISCV_IRQ_WORK_H */
+1 -6
arch/riscv/kernel/vdso/vgettimeofday.c
··· 8 8 9 9 #include <linux/time.h> 10 10 #include <linux/types.h> 11 + #include <vdso/gettime.h> 11 12 12 - extern 13 - int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts); 14 13 int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts) 15 14 { 16 15 return __cvdso_clock_gettime(clock, ts); 17 16 } 18 17 19 - extern 20 - int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz); 21 18 int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) 22 19 { 23 20 return __cvdso_gettimeofday(tv, tz); 24 21 } 25 22 26 - extern 27 - int __vdso_clock_getres(clockid_t clock_id, struct __kernel_timespec *res); 28 23 int __vdso_clock_getres(clockid_t clock_id, struct __kernel_timespec *res) 29 24 { 30 25 return __cvdso_clock_getres(clock_id, res);
-2
arch/s390/include/asm/irq_work.h
··· 7 7 return true; 8 8 } 9 9 10 - void arch_irq_work_raise(void); 11 - 12 10 #endif /* _ASM_S390_IRQ_WORK_H */
+3
arch/sh/include/asm/traps_32.h
··· 43 43 asmlinkage void do_address_error(struct pt_regs *regs, 44 44 unsigned long writeaccess, 45 45 unsigned long address); 46 + asmlinkage void do_page_fault(struct pt_regs *regs, 47 + unsigned long error_code, 48 + unsigned long address); 46 49 asmlinkage void do_divide_error(unsigned long r4); 47 50 asmlinkage void do_reserved_inst(void); 48 51 asmlinkage void do_illegal_slot_inst(void);
+3 -3
arch/sparc/kernel/asm-offsets.c
··· 19 19 #include <asm/hibernate.h> 20 20 21 21 #ifdef CONFIG_SPARC32 22 - int sparc32_foo(void) 22 + static int __used sparc32_foo(void) 23 23 { 24 24 DEFINE(AOFF_thread_fork_kpsr, 25 25 offsetof(struct thread_struct, fork_kpsr)); 26 26 return 0; 27 27 } 28 28 #else 29 - int sparc64_foo(void) 29 + static int __used sparc64_foo(void) 30 30 { 31 31 #ifdef CONFIG_HIBERNATION 32 32 BLANK(); ··· 45 45 } 46 46 #endif 47 47 48 - int foo(void) 48 + static int __used foo(void) 49 49 { 50 50 BLANK(); 51 51 DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread));
+1
arch/sparc/kernel/traps_32.c
··· 10 10 * I hate traps on the sparc, grrr... 11 11 */ 12 12 13 + #include <linux/cpu.h> 13 14 #include <linux/sched/mm.h> 14 15 #include <linux/sched/debug.h> 15 16 #include <linux/mm_types.h>
+1
arch/sparc/kernel/traps_64.c
··· 9 9 * I like traps on v9, :)))) 10 10 */ 11 11 12 + #include <linux/cpu.h> 12 13 #include <linux/extable.h> 13 14 #include <linux/sched/mm.h> 14 15 #include <linux/sched/debug.h>
+1 -9
arch/x86/entry/vdso/vclock_gettime.c
··· 11 11 #include <linux/time.h> 12 12 #include <linux/kernel.h> 13 13 #include <linux/types.h> 14 + #include <vdso/gettime.h> 14 15 15 16 #include "../../../../lib/vdso/gettimeofday.c" 16 - 17 - extern int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz); 18 - extern __kernel_old_time_t __vdso_time(__kernel_old_time_t *t); 19 17 20 18 int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) 21 19 { ··· 33 35 34 36 #if defined(CONFIG_X86_64) && !defined(BUILD_VDSO32_64) 35 37 /* both 64-bit and x32 use these */ 36 - extern int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts); 37 - extern int __vdso_clock_getres(clockid_t clock, struct __kernel_timespec *res); 38 - 39 38 int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts) 40 39 { 41 40 return __cvdso_clock_gettime(clock, ts); ··· 51 56 52 57 #else 53 58 /* i386 only */ 54 - extern int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts); 55 - extern int __vdso_clock_getres(clockid_t clock, struct old_timespec32 *res); 56 - 57 59 int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts) 58 60 { 59 61 return __cvdso_clock_gettime32(clock, ts);
-1
arch/x86/include/asm/irq_work.h
··· 9 9 { 10 10 return boot_cpu_has(X86_FEATURE_APIC); 11 11 } 12 - extern void arch_irq_work_raise(void); 13 12 #else 14 13 static inline bool arch_irq_work_has_interrupt(void) 15 14 {
-1
arch/x86/include/asm/traps.h
··· 14 14 asmlinkage __visible notrace struct pt_regs *sync_regs(struct pt_regs *eregs); 15 15 asmlinkage __visible notrace 16 16 struct pt_regs *fixup_bad_iret(struct pt_regs *bad_regs); 17 - void __init trap_init(void); 18 17 asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *eregs); 19 18 #endif 20 19
-2
arch/x86/include/asm/vdso/gettimeofday.h
··· 337 337 } 338 338 #define vdso_calc_delta vdso_calc_delta 339 339 340 - int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts); 341 - 342 340 #endif /* !__ASSEMBLY__ */ 343 341 344 342 #endif /* __ASM_VDSO_GETTIMEOFDAY_H */
+1
arch/x86/kernel/traps.c
··· 37 37 #include <linux/nmi.h> 38 38 #include <linux/mm.h> 39 39 #include <linux/smp.h> 40 + #include <linux/cpu.h> 40 41 #include <linux/io.h> 41 42 #include <linux/hardirq.h> 42 43 #include <linux/atomic.h>
+3
include/linux/irq_work.h
··· 66 66 void irq_work_run(void); 67 67 bool irq_work_needs_cpu(void); 68 68 void irq_work_single(void *arg); 69 + 70 + void arch_irq_work_raise(void); 71 + 69 72 #else 70 73 static inline bool irq_work_needs_cpu(void) { return false; } 71 74 static inline void irq_work_run(void) { }
+23
include/vdso/gettime.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _VDSO_GETTIME_H 3 + #define _VDSO_GETTIME_H 4 + 5 + #include <linux/types.h> 6 + 7 + struct __kernel_timespec; 8 + struct timezone; 9 + 10 + #if !defined(CONFIG_64BIT) || defined(BUILD_VDSO32_64) 11 + struct old_timespec32; 12 + int __vdso_clock_getres(clockid_t clock, struct old_timespec32 *res); 13 + int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts); 14 + #else 15 + int __vdso_clock_getres(clockid_t clock, struct __kernel_timespec *res); 16 + int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts); 17 + #endif 18 + 19 + __kernel_old_time_t __vdso_time(__kernel_old_time_t *t); 20 + int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz); 21 + int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts); 22 + 23 + #endif