Skip to contentSkip to conversation

Remove redundant extern declarations

PATCH Applied Safocl Stollmannovic 3 participants 17 messages Nov 14 – Nov 20

Subsystems (16)
Arm (32-bit) x86 MIPS RISC-V +12 more subsystems
lore
Share & tools
lore
#0 lore raw

v3 cover Remove redundant extern declarations

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

Changes in v3:
- Split into separate patches for suspend, start_kernel, sched/task, printk, and lockdep

Safocl Stollmannovic (14):
ARM: fix duplicate extern declarations
loongarch: fix duplicate extern declarations
microblaze: fix duplicate extern declarations
MIPS: fix duplicate extern declarations
openrisc: fix duplicate extern declarations
riscv: fix duplicate extern declarations
x86: fix duplicate extern declarations
drivers: fix duplicate extern declarations sched/preempt: fix duplicate extern declarations
lockdep: fix duplicate extern declarations
printk: fix duplicate extern declarations shed/task: fix duplicate extern declarations
start_kernel: fix duplicate extern declarations
suspend: fix duplicate extern declarations

 arch/arm/include/asm/bug.h                |  2 +-
 arch/arm/include/asm/opcodes.h            |  2 +-
 arch/loongarch/include/asm/idle.h         |  2 +-
 arch/loongarch/include/asm/smp.h          |  4 +-
 arch/loongarch/include/asm/switch_to.h    |  2 +-
 arch/microblaze/include/asm/entry.h       |  2 +-
 arch/microblaze/kernel/microblaze_ksyms.c |  2 +-
 arch/mips/cavium-octeon/setup.c           |  2 +-
 arch/mips/include/asm/bmips.h             |  2 +-
 arch/mips/include/asm/idle.h              |  2 +-
 arch/mips/include/asm/paccess.h           |  4 +-
 arch/mips/include/asm/ptrace.h            |  4 +-
 arch/mips/include/asm/smp.h               |  2 +-
 arch/mips/include/asm/switch_to.h         |  2 +-
 arch/mips/kernel/r4k-bugs64.c             |  2 +-
 arch/mips/kernel/signal-common.h          |  8 ++--
 arch/mips/kernel/traps.c                  | 50 +++++++++++------------
 arch/openrisc/kernel/process.c            |  2 +-
 arch/riscv/include/asm/string.h           | 24 +++++------
 arch/riscv/kernel/process.c               |  4 +-
 arch/riscv/kernel/stacktrace.c            |  2 +-
 arch/x86/include/asm/efi.h                |  2 +-
 arch/x86/include/asm/gsseg.h              |  2 +-
 arch/x86/include/asm/preempt.h            |  8 ++--
 arch/x86/include/asm/processor.h          |  2 +-
 arch/x86/include/asm/suspend.h            |  2 +-
 arch/x86/um/sys_call_table_32.c           |  4 +-
 arch/x86/um/sys_call_table_64.c           |  4 +-
 drivers/soc/bcm/brcmstb/pm/pm.h           |  6 +--
 include/asm-generic/preempt.h             |  4 +-
 include/linux/lockdep.h                   |  2 +-
 include/linux/printk.h                    |  6 +--
 include/linux/sched/task.h                |  2 +-
 include/linux/start_kernel.h              |  2 +-
 include/linux/suspend.h                   |  4 +-
 35 files changed, 88 insertions(+), 88 deletions(-)
Signature · 1 line
2.56.1
#1 lore raw

PATCH v3 1/14 ARM: fix duplicate extern declarations

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 arch/arm/include/asm/bug.h     | 2 +-
 arch/arm/include/asm/opcodes.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/bug.h +1 -1
index ba8d9d7d2..985857d65 100644
@@ -82,7 +82,7 @@ void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
 				       struct pt_regs *),
 		     int sig, int code, const char *name);
 
-extern asmlinkage void c_backtrace(unsigned long fp, int pmode,
+asmlinkage void c_backtrace(unsigned long fp, int pmode,
 				   const char *loglvl);
 
 struct mm_struct;
arch/arm/include/asm/opcodes.h +1 -1
index 38e3eabff..afa29833f 100644
@@ -8,7 +8,7 @@
 
 #ifndef __ASSEMBLY__
 #include <linux/linkage.h>
-extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr);
+asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr);
 #endif
 
 #define ARM_OPCODE_CONDTEST_FAIL   0
Signature · 1 line
2.56.1
#2 lore raw

PATCH v3 2/14 loongarch: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 arch/loongarch/include/asm/idle.h      | 2 +-
 arch/loongarch/include/asm/smp.h       | 4 ++--
 arch/loongarch/include/asm/switch_to.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
arch/loongarch/include/asm/idle.h +1 -1
index f7f2b7dbf..9913191cb 100644
@@ -4,6 +4,6 @@
 
 #include <linux/linkage.h>
 
-extern asmlinkage void __arch_cpu_idle(void);
+asmlinkage void __arch_cpu_idle(void);
 
 #endif /* __ASM_IDLE_H  */
arch/loongarch/include/asm/smp.h +2 -2
index dd1457065..c21a5b60e 100644
@@ -87,8 +87,8 @@ struct secondary_data {
 };
 extern struct secondary_data cpuboot_data;
 
-extern asmlinkage void smpboot_entry(void);
-extern asmlinkage void start_secondary(void);
+asmlinkage void smpboot_entry(void);
+asmlinkage void start_secondary(void);
 
 extern void calculate_cpu_foreign_map(void);
 
arch/loongarch/include/asm/switch_to.h +1 -1
index ab9e0292c..aa5d3da68 100644
@@ -21,7 +21,7 @@ struct task_struct;
  * This function is used whilst scheduling to save the context of prev & load
  * the context of next. Returns prev.
  */
-extern asmlinkage struct task_struct *__switch_to(struct task_struct *prev,
+asmlinkage struct task_struct *__switch_to(struct task_struct *prev,
 			struct task_struct *next, void *sched_ra, void *sched_cfa);
 
 /*
Signature · 1 line
2.56.1
#3 lore raw

PATCH v3 3/14 microblaze: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 arch/microblaze/include/asm/entry.h       | 2 +-
 arch/microblaze/kernel/microblaze_ksyms.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/microblaze/include/asm/entry.h +1 -1
index 05acf4d7b..f3e4a6eaa 100644
@@ -41,7 +41,7 @@ DECLARE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */
 DECLARE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */
 DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
 
-extern asmlinkage void do_notify_resume(struct pt_regs *regs, int in_syscall);
+asmlinkage void do_notify_resume(struct pt_regs *regs, int in_syscall);
 # endif /* __ASSEMBLER__ */
 
 #endif /* _ASM_MICROBLAZE_ENTRY_H */
arch/microblaze/kernel/microblaze_ksyms.c +1 -1
index ad7596d7b..40915d400 100644
@@ -51,6 +51,6 @@ extern void xmb_manager_register(uintptr_t phys_baseaddr, u32 cr_val,
 				 void (*callback)(void *data),
 				 void *priv, void (*reset_callback)(void *data));
 EXPORT_SYMBOL(xmb_manager_register);
-extern asmlinkage void xmb_inject_err(void);
+asmlinkage void xmb_inject_err(void);
 EXPORT_SYMBOL(xmb_inject_err);
 #endif
Signature · 1 line
2.56.1
#4 lore raw

PATCH v3 4/14 MIPS: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 arch/mips/cavium-octeon/setup.c   |  2 +-
 arch/mips/include/asm/bmips.h     |  2 +-
 arch/mips/include/asm/idle.h      |  2 +-
 arch/mips/include/asm/paccess.h   |  4 +--
 arch/mips/include/asm/ptrace.h    |  4 +--
 arch/mips/include/asm/smp.h       |  2 +-
 arch/mips/include/asm/switch_to.h |  2 +-
 arch/mips/kernel/r4k-bugs64.c     |  2 +-
 arch/mips/kernel/signal-common.h  |  8 ++---
 arch/mips/kernel/traps.c          | 50 +++++++++++++++----------------
 10 files changed, 39 insertions(+), 39 deletions(-)
arch/mips/cavium-octeon/setup.c +1 -1
index 7497be7b9..c2ee7d8bc 100644
@@ -296,7 +296,7 @@ static uint64_t crashk_size, crashk_base;
 
 static int octeon_uart;
 
-extern asmlinkage void handle_int(void);
+asmlinkage void handle_int(void);
 
 /**
  * octeon_is_simulation - Return non-zero if we are currently running
arch/mips/include/asm/bmips.h +1 -1
index 0eee81be9..a0de86e0d 100644
@@ -88,7 +88,7 @@ extern cpumask_t bmips_booted_mask;
 extern unsigned long bmips_tp1_irqs;
 
 extern void bmips_ebase_setup(void);
-extern asmlinkage void plat_wired_tlb_setup(void);
+asmlinkage void plat_wired_tlb_setup(void);
 extern void bmips_cpu_setup(void);
 
 static inline unsigned long bmips_read_zscm_reg(unsigned int offset)
arch/mips/include/asm/idle.h +1 -1
index c7d75807d..58b201eb4 100644
@@ -6,7 +6,7 @@
 #include <linux/linkage.h>
 
 extern void (*cpu_wait)(void);
-extern asmlinkage void r4k_wait(void);
+asmlinkage void r4k_wait(void);
 extern void r4k_wait_irqoff(void);
 
 static inline int using_skipover_handler(void)
arch/mips/include/asm/paccess.h +2 -2
index af81ab0da..67efa9440 100644
@@ -22,8 +22,8 @@
 #define __PA_ADDR	".dword"
 #endif
 
-extern asmlinkage void handle_ibe(void);
-extern asmlinkage void handle_dbe(void);
+asmlinkage void handle_ibe(void);
+asmlinkage void handle_dbe(void);
 
 #define put_dbe(x, ptr) __put_dbe((x), (ptr), sizeof(*(ptr)))
 #define get_dbe(x, ptr) __get_dbe((x), (ptr), sizeof(*(ptr)))
arch/mips/include/asm/ptrace.h +2 -2
index ef72c46b5..5673c7518 100644
@@ -160,8 +160,8 @@ extern unsigned long exception_ip(struct pt_regs *regs);
 #define exception_ip(regs) exception_ip(regs)
 #define profile_pc(regs) instruction_pointer(regs)
 
-extern asmlinkage long syscall_trace_enter(struct pt_regs *regs);
-extern asmlinkage void syscall_trace_leave(struct pt_regs *regs);
+asmlinkage long syscall_trace_enter(struct pt_regs *regs);
+asmlinkage void syscall_trace_leave(struct pt_regs *regs);
 
 extern void die(const char *, struct pt_regs *) __noreturn;
 
arch/mips/include/asm/smp.h +1 -1
index a545568f1..5e1b73a06 100644
@@ -58,7 +58,7 @@ extern cpumask_t cpu_coherent_mask;
 
 extern unsigned int smp_max_threads __initdata;
 
-extern asmlinkage void smp_bootstrap(void);
+asmlinkage void smp_bootstrap(void);
 
 extern void calculate_cpu_foreign_map(void);
 
arch/mips/include/asm/switch_to.h +1 -1
index d6ccd5344..a9d6616ad 100644
@@ -29,7 +29,7 @@ struct task_struct;
  * This function is used whilst scheduling to save the context of prev & load
  * the context of next. Returns prev.
  */
-extern asmlinkage struct task_struct *resume(struct task_struct *prev,
+asmlinkage struct task_struct *resume(struct task_struct *prev,
 		struct task_struct *next, struct thread_info *next_ti);
 
 extern unsigned int ll_bit;
arch/mips/kernel/r4k-bugs64.c +1 -1
index 83970ac7e..31bf3146f 100644
@@ -182,7 +182,7 @@ asmlinkage void __init do_daddi_ov(struct pt_regs *regs)
 
 static __init void check_daddi(void)
 {
-	extern asmlinkage void handle_daddi_ov(void);
+	asmlinkage void handle_daddi_ov(void);
 	unsigned long flags;
 	void *handler;
 	long v, tmp;
arch/mips/kernel/signal-common.h +4 -4
index 136eb20ac..65e262b7f 100644
@@ -32,13 +32,13 @@ extern int fpcsr_pending(unsigned int __user *fpcsr);
 #define unlock_fpu_owner()	({ pagefault_enable(); preempt_enable(); })
 
 /* Assembly functions to move context to/from the FPU */
-extern asmlinkage int
+asmlinkage int
 _save_fp_context(void __user *fpregs, void __user *csr);
-extern asmlinkage int
+asmlinkage int
 _restore_fp_context(void __user *fpregs, void __user *csr);
 
-extern asmlinkage int _save_msa_all_upper(void __user *buf);
-extern asmlinkage int _restore_msa_all_upper(void __user *buf);
+asmlinkage int _save_msa_all_upper(void __user *buf);
+asmlinkage int _restore_msa_all_upper(void __user *buf);
 
 extern int setup_sigcontext(struct pt_regs *, struct sigcontext __user *);
 extern int restore_sigcontext(struct pt_regs *, struct sigcontext __user *);
arch/mips/kernel/traps.c +25 -25

56 lines not on this page · raw message

Signature · 1 line
2.56.1
#5 lore raw

PATCH v3 5/14 openrisc: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 arch/openrisc/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/openrisc/kernel/process.c +1 -1
index 73ffb9fa3..c46899806 100644
@@ -129,7 +129,7 @@ void show_regs(struct pt_regs *regs)
  * Copy the thread-specific (arch specific) info from the current
  * process to the new one p
  */
-extern asmlinkage void ret_from_fork(void);
+asmlinkage void ret_from_fork(void);
 
 /*
  * copy_thread
Signature · 1 line
2.56.1
#6 lore raw

PATCH v3 6/14 riscv: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 arch/riscv/include/asm/string.h | 24 ++++++++++++------------
 arch/riscv/kernel/process.c     |  4 ++--
 arch/riscv/kernel/stacktrace.c  |  2 +-
 3 files changed, 15 insertions(+), 15 deletions(-)
arch/riscv/include/asm/string.h +12 -12
index 764ffe8f6..ac895358c 100644
@@ -10,33 +10,33 @@
 #include <linux/linkage.h>
 
 #define __HAVE_ARCH_MEMSET
-extern asmlinkage void *memset(void *, int, size_t);
-extern asmlinkage void *__memset(void *, int, size_t);
+asmlinkage void *memset(void *, int, size_t);
+asmlinkage void *__memset(void *, int, size_t);
 #define __HAVE_ARCH_MEMCPY
-extern asmlinkage void *memcpy(void *, const void *, size_t);
-extern asmlinkage void *__memcpy(void *, const void *, size_t);
+asmlinkage void *memcpy(void *, const void *, size_t);
+asmlinkage void *__memcpy(void *, const void *, size_t);
 #define __HAVE_ARCH_MEMMOVE
-extern asmlinkage void *memmove(void *, const void *, size_t);
-extern asmlinkage void *__memmove(void *, const void *, size_t);
+asmlinkage void *memmove(void *, const void *, size_t);
+asmlinkage void *__memmove(void *, const void *, size_t);
 
 #if !(defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS))
 #define __HAVE_ARCH_STRCMP
-extern asmlinkage int strcmp(const char *cs, const char *ct);
+asmlinkage int strcmp(const char *cs, const char *ct);
 
 #define __HAVE_ARCH_STRLEN
-extern asmlinkage __kernel_size_t strlen(const char *);
+asmlinkage __kernel_size_t strlen(const char *);
 
 #define __HAVE_ARCH_STRNCMP
-extern asmlinkage int strncmp(const char *cs, const char *ct, size_t count);
+asmlinkage int strncmp(const char *cs, const char *ct, size_t count);
 
 #define __HAVE_ARCH_STRNLEN
-extern asmlinkage __kernel_size_t strnlen(const char *, size_t);
+asmlinkage __kernel_size_t strnlen(const char *, size_t);
 
 #define __HAVE_ARCH_STRCHR
-extern asmlinkage char *strchr(const char *, int);
+asmlinkage char *strchr(const char *, int);
 
 #define __HAVE_ARCH_STRRCHR
-extern asmlinkage char *strrchr(const char *, int);
+asmlinkage char *strrchr(const char *, int);
 #endif
 
 /* For those files which don't want to check by kasan. */
arch/riscv/kernel/process.c +2 -2
index 34c1d498d..3e531b6d0 100644
@@ -39,8 +39,8 @@ unsigned long __stack_chk_guard __read_mostly;
 EXPORT_SYMBOL(__stack_chk_guard);
 #endif
 
-extern asmlinkage void ret_from_fork_kernel_asm(void);
-extern asmlinkage void ret_from_fork_user_asm(void);
+asmlinkage void ret_from_fork_kernel_asm(void);
+asmlinkage void ret_from_fork_user_asm(void);
 
 void noinstr arch_cpu_idle(void)
 {
arch/riscv/kernel/stacktrace.c +1 -1
index c75554471..6ca60cd3d 100644
@@ -32,7 +32,7 @@
 	val;						\
 })
 
-extern asmlinkage void handle_exception(void);
+asmlinkage void handle_exception(void);
 extern unsigned long ret_from_exception_end;
 
 static inline int fp_is_valid(unsigned long fp, unsigned long sp)
Signature · 1 line
2.56.1
#7 lore raw

PATCH v3 7/14 x86: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 arch/x86/include/asm/efi.h       | 2 +-
 arch/x86/include/asm/gsseg.h     | 2 +-
 arch/x86/include/asm/preempt.h   | 8 ++++----
 arch/x86/include/asm/processor.h | 2 +-
 arch/x86/include/asm/suspend.h   | 2 +-
 arch/x86/um/sys_call_table_32.c  | 4 ++--
 arch/x86/um/sys_call_table_64.c  | 4 ++--
 7 files changed, 12 insertions(+), 12 deletions(-)
arch/x86/include/asm/efi.h +1 -1
index be58b7f5c..f5cb179b8 100644
@@ -94,7 +94,7 @@ static inline void efi_fpu_end(void)
 #else /* !CONFIG_X86_32 */
 #define EFI_X86_KERNEL_ALLOC_LIMIT		EFI_ALLOC_LIMIT
 
-extern asmlinkage u64 __efi_call(void *fp, ...);
+asmlinkage u64 __efi_call(void *fp, ...);
 
 extern bool efi_disable_ibt_for_runtime;
 
arch/x86/include/asm/gsseg.h +1 -1
index ab6a595ce..81ef16081 100644
@@ -12,7 +12,7 @@
 
 #ifdef CONFIG_X86_64
 
-extern asmlinkage void asm_load_gs_index(u16 selector);
+asmlinkage void asm_load_gs_index(u16 selector);
 
 /* Replace with "lkgs %di" once binutils support LKGS instruction */
 #define LKGS_DI _ASM_BYTES(0xf2,0x0f,0x00,0xf7)
arch/x86/include/asm/preempt.h +4 -4
index d16d9c2f7..135695ae3 100644
@@ -134,11 +134,11 @@ static __always_inline bool should_resched(int preempt_offset)
 
 #ifdef CONFIG_PREEMPTION
 
-extern asmlinkage void preempt_schedule(void);
-extern asmlinkage void preempt_schedule_thunk(void);
+asmlinkage void preempt_schedule(void);
+asmlinkage void preempt_schedule_thunk(void);
 
-extern asmlinkage void preempt_schedule_notrace(void);
-extern asmlinkage void preempt_schedule_notrace_thunk(void);
+asmlinkage void preempt_schedule_notrace(void);
+asmlinkage void preempt_schedule_notrace_thunk(void);
 
 #define __preempt_schedule() \
 	asm volatile ("call preempt_schedule_thunk" : ASM_CALL_CONSTRAINT);
arch/x86/include/asm/processor.h +1 -1
index 77488ff5e..68d7292af 100644
@@ -455,7 +455,7 @@ static inline unsigned long cpu_kernelmode_gs_base(int cpu)
 #endif
 }
 
-extern asmlinkage void entry_SYSCALL32_ignore(void);
+asmlinkage void entry_SYSCALL32_ignore(void);
 
 /* Save actual FS/GS selectors and bases to current->thread */
 void current_save_fsgs(void);
arch/x86/include/asm/suspend.h +1 -1
index a892494ca..e29c071b9 100644
@@ -11,4 +11,4 @@ extern unsigned long temp_pgt __visible;
 extern unsigned long relocated_restore_code __visible;
 extern int relocate_restore_code(void);
 /* Defined in hibernate_asm_32/64.S */
-extern asmlinkage __visible int restore_image(void);
+asmlinkage __visible int restore_image(void);
arch/x86/um/sys_call_table_32.c +2 -2
index 51655133e..f79c0138e 100644
@@ -9,7 +9,7 @@
 #include <linux/cache.h>
 #include <asm/syscall.h>
 
-extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long,
+asmlinkage long sys_ni_syscall(unsigned long, unsigned long,
 				      unsigned long, unsigned long,
 				      unsigned long, unsigned long);
 
@@ -28,7 +28,7 @@ extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long,
 #define __SYSCALL_WITH_COMPAT(nr, native, compat)	__SYSCALL(nr, native)
 #define __SYSCALL_NORETURN __SYSCALL
 
-#define __SYSCALL(nr, sym) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
+#define __SYSCALL(nr, sym) asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
 #include <asm/syscalls_32.h>
 #undef  __SYSCALL
 
arch/x86/um/sys_call_table_64.c +2 -2
index 943d414f2..555e65e66 100644
@@ -9,7 +9,7 @@
 #include <linux/cache.h>
 #include <asm/syscall.h>
 
-extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long,
+asmlinkage long sys_ni_syscall(unsigned long, unsigned long,
 				      unsigned long, unsigned long,
 				      unsigned long, unsigned long);
 
@@ -24,7 +24,7 @@ extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long,
 
 #define __SYSCALL_NORETURN __SYSCALL
 
-#define __SYSCALL(nr, sym) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
+#define __SYSCALL(nr, sym) asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
 #include <asm/syscalls_64.h>
 #undef  __SYSCALL
 
Signature · 1 line
2.56.1
#8 lore raw

PATCH v3 8/14 drivers: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 drivers/soc/bcm/brcmstb/pm/pm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/soc/bcm/brcmstb/pm/pm.h +3 -3
index 17f7a06a7..041b7ae96 100644
@@ -64,14 +64,14 @@
 
 #ifndef CONFIG_MIPS
 extern const unsigned long brcmstb_pm_do_s2_sz;
-extern asmlinkage int brcmstb_pm_do_s2(void __iomem *aon_ctrl_base,
+asmlinkage int brcmstb_pm_do_s2(void __iomem *aon_ctrl_base,
 		void __iomem *ddr_phy_pll_status);
 #else
 /* s2 asm */
-extern asmlinkage int brcm_pm_do_s2(u32 *s2_params);
+asmlinkage int brcm_pm_do_s2(u32 *s2_params);
 
 /* s3 asm */
-extern asmlinkage int brcm_pm_do_s3(void __iomem *aon_ctrl_base,
+asmlinkage int brcm_pm_do_s3(void __iomem *aon_ctrl_base,
 		int dcache_linesz);
 extern int s3_reentry;
 #endif /* CONFIG_MIPS */
Signature · 1 line
2.56.1
maintainer Applied
#9 lore raw

Re: [PATCH v3 08/14] drivers: fix duplicate extern declarations

Quoted 11 lines · Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

I applied v2 which was not different to this tree:

https://github.com/Broadcom/stblinux/commit/0cab822bca7a59667774725b83e948b71462290f

the subject was reworded because yours was not specific enough and did not match contributions made to this file previously.

Signature · 1 line
Florian
#10 lore raw

PATCH v3 9/14 sched/preempt: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 include/asm-generic/preempt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/preempt.h +2 -2
index 1adddeab8..fc0da591d 100644
@@ -93,8 +93,8 @@ static __always_inline bool should_resched(int preempt_offset)
 }
 
 #ifdef CONFIG_PREEMPTION
-extern asmlinkage void preempt_schedule(void);
-extern asmlinkage void preempt_schedule_notrace(void);
+asmlinkage void preempt_schedule(void);
+asmlinkage void preempt_schedule_notrace(void);
 
 #define __preempt_schedule() preempt_schedule()
 #define __preempt_schedule_notrace() preempt_schedule_notrace()
Signature · 1 line
2.56.1
#11 lore raw

PATCH v3 10/14 lockdep: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 include/linux/lockdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/lockdep.h +1 -1
index a6451ecbb..f436eab07 100644
@@ -89,7 +89,7 @@ extern void lockdep_init(void);
 extern void lockdep_reset(void);
 extern void lockdep_reset_lock(struct lockdep_map *lock);
 extern void lockdep_free_key_range(void *start, unsigned long size);
-extern asmlinkage void lockdep_sys_exit(void);
+asmlinkage void lockdep_sys_exit(void);
 extern void lockdep_set_selftest_task(struct task_struct *task);
 
 extern void lockdep_init_task(struct task_struct *task);
Signature · 1 line
2.56.1
#12 lore raw

PATCH v3 11/14 printk: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 include/linux/printk.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/printk.h +3 -3
index f594c1266..09a28181e 100644
@@ -136,7 +136,7 @@ struct va_format {
 })
 
 #ifdef CONFIG_EARLY_PRINTK
-extern asmlinkage __printf(1, 2)
+asmlinkage __printf(1, 2)
 void early_printk(const char *fmt, ...);
 #else
 static inline __printf(1, 2) __cold
@@ -200,8 +200,8 @@ void __init setup_log_buf(int early);
 __printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...);
 void dump_stack_print_info(const char *log_lvl);
 void show_regs_print_info(const char *log_lvl);
-extern asmlinkage void dump_stack_lvl(const char *log_lvl) __cold;
-extern asmlinkage void dump_stack(void) __cold;
+asmlinkage void dump_stack_lvl(const char *log_lvl) __cold;
+asmlinkage void dump_stack(void) __cold;
 void printk_trigger_flush(void);
 void console_try_replay_all(void);
 void printk_legacy_allow_panic_sync(void);
Signature · 1 line
2.56.1
#13 lore raw

PATCH v3 12/14 shed/task: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 include/linux/sched/task.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/sched/task.h +1 -1
index 90ed5bc3c..5cdef6b0f 100644
@@ -61,7 +61,7 @@ extern struct task_struct init_task;
 
 extern int lockdep_tasklist_lock_is_held(void);
 
-extern asmlinkage void schedule_tail(struct task_struct *prev);
+asmlinkage void schedule_tail(struct task_struct *prev);
 extern void init_idle(struct task_struct *idle, int cpu);
 
 extern int sched_fork(u64 clone_flags, struct task_struct *p);
Signature · 1 line
2.56.1
#14 lore raw

PATCH v3 13/14 start_kernel: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 include/linux/start_kernel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/start_kernel.h +1 -1
index 09f994ac8..5855467ca 100644
@@ -8,6 +8,6 @@
 /* Define the prototype for start_kernel here, rather than cluttering
    up something else. */
 
-extern asmlinkage void __init __noreturn start_kernel(void);
+asmlinkage void __init __noreturn start_kernel(void);
 
 #endif /* _LINUX_START_KERNEL_H */
Signature · 1 line
2.56.1
#15 lore raw

PATCH v3 14/14 suspend: fix duplicate extern declarations

In reply to Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 include/linux/suspend.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/suspend.h +2 -2
index a38150277..b97af3420 100644
@@ -385,8 +385,8 @@ extern int swsusp_page_is_forbidden(struct page *);
 extern void swsusp_set_page_free(struct page *);
 extern void swsusp_unset_page_free(struct page *);
 extern unsigned long get_safe_page(gfp_t gfp_mask);
-extern asmlinkage int swsusp_arch_suspend(void);
-extern asmlinkage int swsusp_arch_resume(void);
+asmlinkage int swsusp_arch_suspend(void);
+asmlinkage int swsusp_arch_resume(void);
 
 extern u32 swsusp_hardware_signature;
 extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
Signature · 1 line
2.56.1
maintainer Applied
#16 lore raw

Re: [PATCH v3 14/14] suspend: fix duplicate extern declarations

Quoted 22 lines · Safocl Stollmannovic

Compiling a kernel module with a C++ compiler results in a "duplicate extern specifier" error.
This occurs because the code contains extern asmlinkage, and asmlinkage expands to extern C when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler, I believe it is a perfectly valid approach to gradually move toward a state where kernel modules can be compiled by a C++ compiler without any issues. The extern specifier must be removed.

---
 include/linux/suspend.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/suspend.h +0 -0
index a38150277..b97af3420 100644
@@ -385,8 +385,8 @@ extern int swsusp_page_is_forbidden(struct page *);
 extern void swsusp_set_page_free(struct page *);

include/linux/suspend.h extern int swsusp_page_is_forbidden(struct page *);

Quoted 10 lines
include/linux/suspend.h +2 -3
 extern void swsusp_unset_page_free(struct page *);
 extern unsigned long get_safe_page(gfp_t gfp_mask);
-extern asmlinkage int swsusp_arch_suspend(void);
-extern asmlinkage int swsusp_arch_resume(void);
+asmlinkage int swsusp_arch_suspend(void);
+asmlinkage int swsusp_arch_resume(void);
 
 extern u32 swsusp_hardware_signature;
 extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
--

Applied as 7.5 material, thanks!