Skip to content

Commit

Permalink
trap: cleanup trap_init()
Browse files Browse the repository at this point in the history
There are some empty trap_init() definitions in different ARCHs, Introduce
a new weak trap_init() function to clean them up.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Kefeng Wang <[email protected]>
Acked-by: Russell King (Oracle) <[email protected]>	[arm32]
Acked-by: Vineet Gupta						[arc]
Acked-by: Michael Ellerman <[email protected]>			[powerpc]
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: 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]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Kefeng Wang authored and torvalds committed Sep 8, 2021
1 parent b234ed6 commit 8b09788
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 51 deletions.
5 changes: 0 additions & 5 deletions arch/arc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 0 additions & 5 deletions arch/arm/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 0 additions & 4 deletions arch/h8300/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions arch/hexagon/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 0 additions & 5 deletions arch/nds32/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions arch/nios2/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 0 additions & 5 deletions arch/openrisc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions arch/parisc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,3 @@ void __init early_trap_init(void)

initialize_ivt(&fault_vector_20);
}

void __init trap_init(void)
{
}
5 changes: 0 additions & 5 deletions arch/powerpc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -2215,11 +2215,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 }
Expand Down
5 changes: 0 additions & 5 deletions arch/riscv/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions arch/um/kernel/trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}
2 changes: 2 additions & 0 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,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);

Expand Down

0 comments on commit 8b09788

Please sign in to comment.