genirq: add threaded interrupt handler support
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / kernel / irq / handle.c
index 9ebf77968871550a365713d7a29a6f131f231ee5..fe8f45374e861bbc78d614a292b605fdf534a62e 100644 (file)
@@ -357,8 +357,37 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
 
        do {
                ret = action->handler(irq, action->dev_id);
-               if (ret == IRQ_HANDLED)
+
+               switch (ret) {
+               case IRQ_WAKE_THREAD:
+                       /*
+                        * Wake up the handler thread for this
+                        * action. In case the thread crashed and was
+                        * killed we just pretend that we handled the
+                        * interrupt. The hardirq handler above has
+                        * disabled the device interrupt, so no irq
+                        * storm is lurking.
+                        */
+                       if (likely(!test_bit(IRQTF_DIED,
+                                            &action->thread_flags))) {
+                               set_bit(IRQTF_RUNTHREAD, &action->thread_flags);
+                               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;
+                       break;
+
+               default:
+                       break;
+               }
+
                retval |= ret;
                action = action->next;
        } while (action);