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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Thomas Gleixner
Date: Wednesday, October 1, 2008 - 4:02 pm

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@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
---
 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())


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC patch 4/5] genirq: add a helper to check whether the ..., Thomas Gleixner, (Wed Oct 1, 4:02 pm)