]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/irq/handle.c
Merge branch 'linus' into irq/threaded
[linux-2.6-omap-h63xx.git] / kernel / irq / handle.c
index fe8f45374e861bbc78d614a292b605fdf534a62e..d82142be8dd2c8fddc340058ff9cd73373f6a31b 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/kernel_stat.h>
 #include <linux/rculist.h>
 #include <linux/hash.h>
+#include <trace/irq.h>
 #include <linux/bootmem.h>
 
 #include "internals.h"
@@ -338,6 +339,18 @@ irqreturn_t no_action(int cpl, void *dev_id)
        return IRQ_NONE;
 }
 
+static void warn_no_thread(unsigned int irq, struct irqaction *action)
+{
+       if (test_and_set_bit(IRQTF_WARNED, &action->thread_flags))
+               return;
+
+       printk(KERN_WARNING "IRQ %d device %s returned IRQ_WAKE_THREAD "
+              "but no thread function available.", irq, action->name);
+}
+
+DEFINE_TRACE(irq_handler_entry);
+DEFINE_TRACE(irq_handler_exit);
+
 /**
  * handle_IRQ_event - irq action chain handler
  * @irq:       the interrupt number
@@ -356,10 +369,27 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
                local_irq_enable_in_hardirq();
 
        do {
+               trace_irq_handler_entry(irq, action);
                ret = action->handler(irq, action->dev_id);
+               trace_irq_handler_exit(irq, action, ret);
 
                switch (ret) {
                case IRQ_WAKE_THREAD:
+                       /*
+                        * Set result to handled so the spurious check
+                        * does not trigger.
+                        */
+                       ret = IRQ_HANDLED;
+
+                       /*
+                        * Catch drivers which return WAKE_THREAD but
+                        * did not set up a thread function
+                        */
+                       if (unlikely(!action->thread_fn)) {
+                               warn_no_thread(irq, action);
+                               break;
+                       }
+
                        /*
                         * Wake up the handler thread for this
                         * action. In case the thread crashed and was
@@ -374,11 +404,6 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
                                wake_up_process(action->thread);
                        }
 
-                       /*
-                        * Set it to handled so the spurious check
-                        * does not trigger.
-                        */
-                       ret = IRQ_HANDLED;
                        /* Fall through to add to randomness */
                case IRQ_HANDLED:
                        status |= action->flags;