[RFC patch 4/5] genirq: add a helper to check whether the irq threadshould run

From: Thomas Gleixner
Date: Wed Oct 01 2008 - 19:03:44 EST


The helper allows threaded irq handlers to determine whether another
interrupt arrived or not while the thread is running.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Reviewed-by: Ingo Molnar <mingo@xxxxxxx>
---
include/linux/interrupt.h | 5 +++++
kernel/irq/manage.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)

Index: linux-2.6-tip/include/linux/interrupt.h
===================================================================
--- linux-2.6-tip.orig/include/linux/interrupt.h
+++ linux-2.6-tip/include/linux/interrupt.h
@@ -109,6 +109,11 @@ extern int __must_check devm_request_irq
const char *devname, void *dev_id);
extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);

+static inline int irq_thread_should_run(struct irqaction *action)
+{
+ return test_and_clear_bit(IRQF_RUNTHREAD, &action->flags);
+}
+
/*
* On lockdep we dont want to enable hardirqs in hardirq
* context. Use local_irq_enable_in_hardirq() to annotate
Index: linux-2.6-tip/kernel/irq/manage.c
===================================================================
--- linux-2.6-tip.orig/kernel/irq/manage.c
+++ linux-2.6-tip/kernel/irq/manage.c
@@ -341,7 +341,7 @@ static int irq_thread(void *data)
set_current_state(TASK_INTERRUPTIBLE);

while (!kthread_should_stop()) {
- if (!test_and_clear_bit(IRQF_RUNTHREAD, &action->flags)) {
+ if (!irq_thread_should_run(action)) {
schedule();
/* Avoid running the handler on stop */
if (kthread_should_stop())


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/