Skip to contentSkip to conversation

trap: Cleanup trap_init()

PATCH Applied Kefeng Wang 4 participants 4 messages Aug 12, 2021 – Aug 13, 2021

Subsystems (10)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trap: Cleanup trap_init()

There are some empty trap_init() in different ARCHs, introduce a new weak trap_init() function to cleanup them.

Cc Vineet Gupta <[email protected]>
Cc Russell King <[email protected]>
Cc Yoshinori Sato <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Jonas Bonn <[email protected]>
Cc Stefan Kristiansson <[email protected]>
Cc Stafford Horne <[email protected]>
Cc James E.J. Bottomley <[email protected]>
Cc Helge Deller <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Jeff Dike <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc Anton Ivanov <[email protected]>
Cc Andrew Morton <[email protected]>
---
 arch/arc/kernel/traps.c      | 5 -----
 arch/arm/kernel/traps.c      | 5 -----
 arch/h8300/kernel/traps.c    | 4 ----
 arch/hexagon/kernel/traps.c  | 4 ----
 arch/nds32/kernel/traps.c    | 5 -----
 arch/nios2/kernel/traps.c    | 5 -----
 arch/openrisc/kernel/traps.c | 5 -----
 arch/parisc/kernel/traps.c   | 4 ----
 arch/powerpc/kernel/traps.c  | 5 -----
 arch/riscv/kernel/traps.c    | 5 -----
 arch/um/kernel/trap.c        | 4 ----
 init/main.c                  | 2 ++
 12 files changed, 2 insertions(+), 51 deletions(-)
arch/arc/kernel/traps.c +0 -5
index 57235e5c0cea..6b83e3f2b41c 100644
@@ -20,11 +20,6 @@
 #include <asm/unaligned.h>
 #include <asm/kprobes.h>
 
-void __init trap_init(void)
-{
-	return;
-}
-
 void die(const char *str, struct pt_regs *regs, unsigned long address)
 {
 	show_kernel_fault_diag(str, regs, address);
arch/arm/kernel/traps.c +0 -5
index 64308e3a5d0c..e9b4f2b49bd8 100644
@@ -781,11 +781,6 @@ void abort(void)
 	panic("Oops failed to kill thread");
 }
 
-void __init trap_init(void)
-{
-	return;
-}
-
 #ifdef CONFIG_KUSER_HELPERS
 static void __init kuser_init(void *vectors)
 {
arch/h8300/kernel/traps.c +0 -4
index 5d8b969cd8f3..bdbe988d8dbc 100644
@@ -39,10 +39,6 @@ void __init base_trap_init(void)
 {
 }
 
-void __init trap_init(void)
-{
-}
-
 asmlinkage void set_esp0(unsigned long ssp)
 {
 	current->thread.esp0 = ssp;
arch/hexagon/kernel/traps.c +0 -4
index 904134b37232..edfc35dafeb1 100644
@@ -28,10 +28,6 @@
 #define TRAP_SYSCALL	1
 #define TRAP_DEBUG	0xdb
 
-void __init trap_init(void)
-{
-}
-
 #ifdef CONFIG_GENERIC_BUG
 /* Maybe should resemble arch/sh/kernel/traps.c ?? */
 int is_valid_bugaddr(unsigned long addr)
arch/nds32/kernel/traps.c +0 -5
index ee0d9ae192a5..f06421c645af 100644
@@ -183,11 +183,6 @@ void __pgd_error(const char *file, int line, unsigned long val)
 }
 
 extern char *exception_vector, *exception_vector_end;
-void __init trap_init(void)
-{
-	return;
-}
-
 void __init early_trap_init(void)
 {
 	unsigned long ivb = 0;
arch/nios2/kernel/traps.c +0 -5
index b172da4eb1a9..596986a74a26 100644
@@ -105,11 +105,6 @@ void show_stack(struct task_struct *task, unsigned long *stack,
 	printk("%s\n", loglvl);
 }
 
-void __init trap_init(void)
-{
-	/* Nothing to do here */
-}
-
 /* Breakpoint handler */
 asmlinkage void breakpoint_c(struct pt_regs *fp)
 {
arch/openrisc/kernel/traps.c +0 -5
index 4d61333c2623..aa1e709405ac 100644
@@ -231,11 +231,6 @@ void unhandled_exception(struct pt_regs *regs, int ea, int vector)
 	die("Oops", regs, 9);
 }
 
-void __init trap_init(void)
-{
-	/* Nothing needs to be done */
-}
-
 asmlinkage void do_trap(struct pt_regs *regs, unsigned long address)
 {
 	force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->pc);
arch/parisc/kernel/traps.c +0 -4
index 8d8441d4562a..747c328fb886 100644
@@ -859,7 +859,3 @@ void  __init early_trap_init(void)
 
 	initialize_ivt(&fault_vector_20);
 }
-
-void __init trap_init(void)
-{
-}
arch/powerpc/kernel/traps.c +0 -5
index e103b89234cd..91efb5c6f2f3 100644
@@ -2209,11 +2209,6 @@ DEFINE_INTERRUPT_HANDLER(kernel_bad_stack)
 	die("Bad kernel stack pointer", regs, SIGABRT);
 }
 
-void __init trap_init(void)
-{
-}
-
-
 #ifdef CONFIG_PPC_EMULATED_STATS
 
 #define WARN_EMULATED_SETUP(type)	.type = { .name = #type }
arch/riscv/kernel/traps.c +0 -5
index 0a98fd0ddfe9..0daaa3e4630d 100644
@@ -199,11 +199,6 @@ int is_valid_bugaddr(unsigned long pc)
 }
 #endif /* CONFIG_GENERIC_BUG */
 
-/* stvec & scratch is already set from head.S */
-void __init trap_init(void)
-{
-}
-
 #ifdef CONFIG_VMAP_STACK
 static DEFINE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)],
 		overflow_stack)__aligned(16);
arch/um/kernel/trap.c +0 -4
index ad12f78bda7e..3198c4767387 100644
@@ -311,7 +311,3 @@ void winch(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs)
 {
 	do_IRQ(WINCH_IRQ, regs);
 }
-
-void trap_init(void)
-{
-}
init/main.c +2 -0
index 4b4897b791fd..863e5087263d 100644
@@ -775,6 +775,8 @@ void __init __weak poking_init(void) { }
 
 void __init __weak pgtable_cache_init(void) { }
 
+void __init __weak trap_init(void) { }
+
 bool initcall_debug;
 core_param(initcall_debug, initcall_debug, bool, 0644);
 
Signature · 1 line
2.26.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Kefeng Wang

There are some empty trap_init() in different ARCHs, introduce a new weak trap_init() function to cleanup them.

Cc Vineet Gupta <[email protected]>
Cc Russell King <[email protected]>
Cc Yoshinori Sato <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Jonas Bonn <[email protected]>
Cc Stefan Kristiansson <[email protected]>
Cc Stafford Horne <[email protected]>
Cc James E.J. Bottomley <[email protected]>
Cc Helge Deller <[email protected]>
Cc Michael Ellerman <[email protected]>
Quoted 8 lines
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Jeff Dike <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc Anton Ivanov <[email protected]>
Cc Andrew Morton <[email protected]>

For 32-bit arm:

Thanks!

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Kefeng Wang
Quoted 21 lines · Kefeng Wang

There are some empty trap_init() in different ARCHs, introduce a new weak trap_init() function to cleanup them.

Cc Vineet Gupta<[email protected]>
Cc Russell King<[email protected]>
Cc Yoshinori Sato<[email protected]>
Cc Ley Foon Tan<[email protected]>
Cc Jonas Bonn<[email protected]>
Cc Stefan Kristiansson<[email protected]>
Cc Stafford Horne<[email protected]>
Cc James E.J. Bottomley<[email protected]>
Cc Helge Deller<[email protected]>
Cc Michael Ellerman<[email protected]>
Cc Benjamin Herrenschmidt<[email protected]>
Cc Paul Mackerras<[email protected]>
Cc Paul Walmsley<[email protected]>
Cc Jeff Dike<[email protected]>
Cc Richard Weinberger<[email protected]>
Cc Anton Ivanov<[email protected]>
Cc Andrew Morton<[email protected]>
Quoted 2 lines
---
  arch/arc/kernel/traps.c      | 5 -----
reviewer Acked-by on v1 1/1
#3 lore raw
In reply to Kefeng Wang
Quoted 21 lines · Kefeng Wang

There are some empty trap_init() in different ARCHs, introduce a new weak trap_init() function to cleanup them.

Cc Vineet Gupta <[email protected]>
Cc Russell King <[email protected]>
Cc Yoshinori Sato <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Jonas Bonn <[email protected]>
Cc Stefan Kristiansson <[email protected]>
Cc Stafford Horne <[email protected]>
Cc James E.J. Bottomley <[email protected]>
Cc Helge Deller <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Jeff Dike <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc Anton Ivanov <[email protected]>
Cc Andrew Morton <[email protected]>
Quoted 10 lines
---
 arch/arc/kernel/traps.c      | 5 -----
 arch/arm/kernel/traps.c      | 5 -----
 arch/h8300/kernel/traps.c    | 4 ----
 arch/hexagon/kernel/traps.c  | 4 ----
 arch/nds32/kernel/traps.c    | 5 -----
 arch/nios2/kernel/traps.c    | 5 -----
 arch/openrisc/kernel/traps.c | 5 -----
 arch/parisc/kernel/traps.c   | 4 ----
 arch/powerpc/kernel/traps.c  | 5 -----

cheers