Title: [6722] trunk/arch/blackfin/kernel/irqchip.c: Blackfin: simplify irq stack overflow checking
Revision
6722
Author
vapier
Date
2009-06-15 05:23:04 -0500 (Mon, 15 Jun 2009)

Log Message

Blackfin: simplify irq stack overflow checking

Take a page from x86 and abstract the stack checking out of the
asm_do_IRQ() function so that the result is easier to digest.

Modified Paths

Diff

Modified: trunk/arch/blackfin/kernel/irqchip.c (6721 => 6722)


--- trunk/arch/blackfin/kernel/irqchip.c	2009-06-15 10:14:48 UTC (rev 6721)
+++ trunk/arch/blackfin/kernel/irqchip.c	2009-06-15 10:23:04 UTC (rev 6722)
@@ -88,6 +88,22 @@
 }
 #endif
 
+#ifdef CONFIG_DEBUG_STACKOVERFLOW
+static void check_stack_overflow(int irq)
+{
+	/* Debugging check for stack overflow: is there less than STACK_WARN free? */
+	long sp = __get_SP() & (THREAD_SIZE - 1);
+
+	if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) {
+		dump_stack();
+		pr_emerg("irq%i: possible stack overflow only %ld bytes free\n",
+			irq, sp - sizeof(struct thread_info));
+	}
+}
+#else
+static inline void check_stack_overflow(int irq) { }
+#endif
+
 /*
  * do_IRQ handles all hardware IRQs.  Decoded IRQs should not
  * come via this function.  Instead, they should provide their
@@ -105,22 +121,8 @@
 
 	irq_enter();
 
-#ifdef CONFIG_DEBUG_STACKOVERFLOW
-	/* Debugging check for stack overflow: is there less than STACK_WARN free? */
-	{
-		long sp;
+	check_stack_overflow(irq);
 
-		sp = __get_SP() & (THREAD_SIZE-1);
-
-		if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) {
-			dump_stack();
-			printk(KERN_EMERG "%s: possible stack overflow while handling irq %i "
-					" only %ld bytes free\n",
-				__func__, irq, sp - sizeof(struct thread_info));
-		}
-	}
-#endif
-
 	/*
 	 * Some hardware gives randomly wrong interrupts.  Rather
 	 * than crashing, do something sensible.
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to