diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2009-04-22 15:31:37 (GMT) |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-05-21 05:43:58 (GMT) |
commit | d7cb10d6d23f451eec3d1f0f4e4e8862333fa152 (patch) | |
tree | 0deb8c084116fdafabbc35074533c9b2b23071cb /arch/powerpc/kernel/irq.c | |
parent | f2694ba56808a3a0fa45d9bb45289575f31e48d2 (diff) | |
download | linux-fsl-qoriq-d7cb10d6d23f451eec3d1f0f4e4e8862333fa152.tar.xz |
powerpc/irq: Move stack overflow check into a separate function
Makes do_IRQ() shorter and clearer.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/irq.c')
-rw-r--r-- | arch/powerpc/kernel/irq.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 3d3658d..463b6ab 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -301,6 +301,22 @@ static inline void handle_one_irq(unsigned int irq) } #endif +static inline void check_stack_overflow(void) +{ +#ifdef CONFIG_DEBUG_STACKOVERFLOW + long sp; + + sp = __get_SP() & (THREAD_SIZE-1); + + /* check for stack overflow: is there less than 2KB free? */ + if (unlikely(sp < (sizeof(struct thread_info) + 2048))) { + printk("do_IRQ: stack overflow: %ld\n", + sp - sizeof(struct thread_info)); + dump_stack(); + } +#endif +} + void do_IRQ(struct pt_regs *regs) { struct pt_regs *old_regs = set_irq_regs(regs); @@ -308,20 +324,7 @@ void do_IRQ(struct pt_regs *regs) irq_enter(); -#ifdef CONFIG_DEBUG_STACKOVERFLOW - /* Debugging check for stack overflow: is there less than 2KB free? */ - { - long sp; - - sp = __get_SP() & (THREAD_SIZE-1); - - if (unlikely(sp < (sizeof(struct thread_info) + 2048))) { - printk("do_IRQ: stack overflow: %ld\n", - sp - sizeof(struct thread_info)); - dump_stack(); - } - } -#endif + check_stack_overflow(); /* * Every platform is required to implement ppc_md.get_irq. |