aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/irq.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2009-03-23 13:28:15 -0400
committerThomas Gleixner <tglx@linutronix.de>2009-03-24 07:15:23 -0400
commit3aa551c9b4c40018f0e261a178e3d25478dc04a9 (patch)
tree2a696109273fcc421d774cc8fefa4180331a85ad /include/linux/irq.h
parent80c5520811d3805adcb15c570ea5e2d489fa5d0b (diff)
genirq: add threaded interrupt handler support
Add support for threaded interrupt handlers: A device driver can request that its main interrupt handler runs in a thread. To achive this the device driver requests the interrupt with request_threaded_irq() and provides additionally to the handler a thread function. The handler function is called in hard interrupt context and needs to check whether the interrupt originated from the device. If the interrupt originated from the device then the handler can either return IRQ_HANDLED or IRQ_WAKE_THREAD. IRQ_HANDLED is returned when no further action is required. IRQ_WAKE_THREAD causes the genirq code to invoke the threaded (main) handler. When IRQ_WAKE_THREAD is returned handler must have disabled the interrupt on the device level. This is mandatory for shared interrupt handlers, but we need to do it as well for obscure x86 hardware where disabling an interrupt on the IO_APIC level redirects the interrupt to the legacy PIC interrupt lines. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/irq.h')
-rw-r--r--include/linux/irq.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 873e4ac11b81..8b1cf0630210 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -20,6 +20,7 @@
20#include <linux/irqreturn.h> 20#include <linux/irqreturn.h>
21#include <linux/irqnr.h> 21#include <linux/irqnr.h>
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/wait.h>
23 24
24#include <asm/irq.h> 25#include <asm/irq.h>
25#include <asm/ptrace.h> 26#include <asm/ptrace.h>
@@ -155,6 +156,8 @@ struct irq_2_iommu;
155 * @affinity: IRQ affinity on SMP 156 * @affinity: IRQ affinity on SMP
156 * @cpu: cpu index useful for balancing 157 * @cpu: cpu index useful for balancing
157 * @pending_mask: pending rebalanced interrupts 158 * @pending_mask: pending rebalanced interrupts
159 * @threads_active: number of irqaction threads currently running
160 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
158 * @dir: /proc/irq/ procfs entry 161 * @dir: /proc/irq/ procfs entry
159 * @name: flow handler name for /proc/interrupts output 162 * @name: flow handler name for /proc/interrupts output
160 */ 163 */
@@ -186,6 +189,8 @@ struct irq_desc {
186 cpumask_var_t pending_mask; 189 cpumask_var_t pending_mask;
187#endif 190#endif
188#endif 191#endif
192 atomic_t threads_active;
193 wait_queue_head_t wait_for_threads;
189#ifdef CONFIG_PROC_FS 194#ifdef CONFIG_PROC_FS
190 struct proc_dir_entry *dir; 195 struct proc_dir_entry *dir;
191#endif 196#endif