diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2013-05-21 17:30:36 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-05-22 01:34:28 +0200 |
commit | f94d9a8ef9aebab5317d11fb1633ba14ad240983 (patch) | |
tree | 5966f1fb50720e3422fe0331f7a2d9a8c7aab488 /arch | |
parent | bdc92d74e0ec95a8101447467c25f015105f2e5a (diff) | |
download | linux-f94d9a8ef9aebab5317d11fb1633ba14ad240983.tar.bz2 |
MIPS: Idle: Do address fiddlery in helper functions.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/include/asm/idle.h | 11 | ||||
-rw-r--r-- | arch/mips/kernel/smtc.c | 3 | ||||
-rw-r--r-- | arch/mips/kernel/traps.c | 7 |
3 files changed, 15 insertions, 6 deletions
diff --git a/arch/mips/include/asm/idle.h b/arch/mips/include/asm/idle.h index 8b26ac5c854e..be6f807c1e3f 100644 --- a/arch/mips/include/asm/idle.h +++ b/arch/mips/include/asm/idle.h @@ -8,4 +8,15 @@ extern asmlinkage void r4k_wait(void); extern void r4k_wait_irqoff(void); extern void __pastwait(void); +static inline int using_rollback_handler(void) +{ + return cpu_wait == r4k_wait; +} + +static inline int address_is_in_r4k_wait_irqoff(unsigned long addr) +{ + return addr >= (unsigned long)r4k_wait_irqoff && + addr < (unsigned long)__pastwait; +} + #endif /* __ASM_IDLE_H */ diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c index 46303bc61364..75a4fd709841 100644 --- a/arch/mips/kernel/smtc.c +++ b/arch/mips/kernel/smtc.c @@ -914,8 +914,7 @@ void smtc_send_ipi(int cpu, int type, unsigned int action) */ if (cpu_wait == r4k_wait_irqoff) { tcrestart = read_tc_c0_tcrestart(); - if (tcrestart >= (unsigned long)r4k_wait_irqoff - && tcrestart < (unsigned long)__pastwait) { + if (address_is_in_r4k_wait_irqoff(tcrestart)) { write_tc_c0_tcrestart(__pastwait); tcstatus &= ~TCSTATUS_IXMT; write_tc_c0_tcstatus(tcstatus); diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index c6da4a905b98..e3be67012d78 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c @@ -1542,7 +1542,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs) extern char except_vec_vi, except_vec_vi_lui; extern char except_vec_vi_ori, except_vec_vi_end; extern char rollback_except_vec_vi; - char *vec_start = (cpu_wait == r4k_wait) ? + char *vec_start = using_rollback_handler() ? &rollback_except_vec_vi : &except_vec_vi; #ifdef CONFIG_MIPS_MT_SMTC /* @@ -1812,10 +1812,8 @@ void __init trap_init(void) extern char except_vec4; extern char except_vec3_r4000; unsigned long i; - int rollback; check_wait(); - rollback = (cpu_wait == r4k_wait); #if defined(CONFIG_KGDB) if (kgdb_early_setup) @@ -1892,7 +1890,8 @@ void __init trap_init(void) if (board_be_init) board_be_init(); - set_except_vector(0, rollback ? rollback_handle_int : handle_int); + set_except_vector(0, using_rollback_handler() ? rollback_handle_int + : handle_int); set_except_vector(1, handle_tlbm); set_except_vector(2, handle_tlbl); set_except_vector(3, handle_tlbs); |