diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-03-24 06:46:22 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-03-24 07:15:23 -0400 |
commit | f48fe81e5b032914183e9a17052313720c2cac56 (patch) | |
tree | 9404047368387a6f8b39b4a822ef28e18eba45e9 /kernel/irq/handle.c | |
parent | 935bd5b971f0df7c06d214d022cf8392e2f37952 (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.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index fe8f45374e86..38b49a9e508a 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -338,6 +338,15 @@ irqreturn_t no_action(int cpl, void *dev_id) | |||
338 | return IRQ_NONE; | 338 | return IRQ_NONE; |
339 | } | 339 | } |
340 | 340 | ||
341 | static void warn_no_thread(unsigned int irq, struct irqaction *action) | ||
342 | { | ||
343 | if (test_and_set_bit(IRQTF_WARNED, &action->thread_flags)) | ||
344 | return; | ||
345 | |||
346 | printk(KERN_WARNING "IRQ %d device %s returned IRQ_WAKE_THREAD " | ||
347 | "but no thread function available.", irq, action->name); | ||
348 | } | ||
349 | |||
341 | /** | 350 | /** |
342 | * handle_IRQ_event - irq action chain handler | 351 | * handle_IRQ_event - irq action chain handler |
343 | * @irq: the interrupt number | 352 | * @irq: the interrupt number |
@@ -361,6 +370,21 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action) | |||
361 | switch (ret) { | 370 | switch (ret) { |
362 | case IRQ_WAKE_THREAD: | 371 | case IRQ_WAKE_THREAD: |
363 | /* | 372 | /* |
373 | * Set result to handled so the spurious check | ||
374 | * does not trigger. | ||
375 | */ | ||
376 | ret = IRQ_HANDLED; | ||
377 | |||
378 | /* | ||
379 | * Catch drivers which return WAKE_THREAD but | ||
380 | * did not set up a thread function | ||
381 | */ | ||
382 | if (unlikely(!action->thread_fn)) { | ||
383 | warn_no_thread(irq, action); | ||
384 | break; | ||
385 | } | ||
386 | |||
387 | /* | ||
364 | * Wake up the handler thread for this | 388 | * Wake up the handler thread for this |
365 | * action. In case the thread crashed and was | 389 | * action. In case the thread crashed and was |
366 | * killed we just pretend that we handled the | 390 | * killed we just pretend that we handled the |
@@ -374,11 +398,6 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action) | |||
374 | wake_up_process(action->thread); | 398 | wake_up_process(action->thread); |
375 | } | 399 | } |
376 | 400 | ||
377 | /* | ||
378 | * Set it to handled so the spurious check | ||
379 | * does not trigger. | ||
380 | */ | ||
381 | ret = IRQ_HANDLED; | ||
382 | /* Fall through to add to randomness */ | 401 | /* Fall through to add to randomness */ |
383 | case IRQ_HANDLED: | 402 | case IRQ_HANDLED: |
384 | status |= action->flags; | 403 | status |= action->flags; |