summaryrefslogtreecommitdiff
path: root/kernel/irq/handle.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2009-03-24 11:46:22 +0100
committerThomas Gleixner <tglx@linutronix.de>2009-03-24 12:15:23 +0100
commitf48fe81e5b032914183e9a17052313720c2cac56 (patch)
tree9404047368387a6f8b39b4a822ef28e18eba45e9 /kernel/irq/handle.c
parent935bd5b971f0df7c06d214d022cf8392e2f37952 (diff)
genirq: threaded irq handlers review fixups
Delta patch to address the review comments. - Implement warning when IRQ_WAKE_THREAD is requested and no thread handler installed - coding style fixes Pointed-out-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq/handle.c')
-rw-r--r--kernel/irq/handle.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index fe8f45374e8..38b49a9e508 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -338,6 +338,15 @@ 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);
+}
+
/**
* handle_IRQ_event - irq action chain handler
* @irq: the interrupt number
@@ -361,6 +370,21 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
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
* killed we just pretend that we handled the
@@ -374,11 +398,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;