aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 17:07:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 17:07:52 -0400
commitc61b79b6ef266890954213a701d8f6021d8c1289 (patch)
tree9b000a7dae5a782a0d667137ab43e4f1bea70d58 /include
parent2b2ec7554cf7ec5e4412f89a5af6abe8ce950700 (diff)
parent9efe21cb82b5dbe3b0b2ae4de4eccc64ecb94e95 (diff)
Merge branch 'irq/threaded' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'irq/threaded' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: genirq: fix devres.o build for GENERIC_HARDIRQS=n genirq: provide old request_irq() for CONFIG_GENERIC_HARDIRQ=n genirq: threaded irq handlers review fixups genirq: add support for threaded interrupts to devres genirq: add threaded interrupt handler support
Diffstat (limited to 'include')
-rw-r--r--include/linux/hardirq.h2
-rw-r--r--include/linux/interrupt.h75
-rw-r--r--include/linux/irq.h5
-rw-r--r--include/linux/irqreturn.h2
-rw-r--r--include/linux/sched.h5
5 files changed, 83 insertions, 6 deletions
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index faa1cf848bcd..45257475623c 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -116,7 +116,7 @@
116# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET 116# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
117#endif 117#endif
118 118
119#ifdef CONFIG_SMP 119#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
120extern void synchronize_irq(unsigned int irq); 120extern void synchronize_irq(unsigned int irq);
121#else 121#else
122# define synchronize_irq(irq) barrier() 122# define synchronize_irq(irq) barrier()
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 8a9613d0c674..91bb76f44f14 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -59,6 +59,18 @@
59#define IRQF_NOBALANCING 0x00000800 59#define IRQF_NOBALANCING 0x00000800
60#define IRQF_IRQPOLL 0x00001000 60#define IRQF_IRQPOLL 0x00001000
61 61
62/*
63 * Bits used by threaded handlers:
64 * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
65 * IRQTF_DIED - handler thread died
66 * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
67 */
68enum {
69 IRQTF_RUNTHREAD,
70 IRQTF_DIED,
71 IRQTF_WARNED,
72};
73
62typedef irqreturn_t (*irq_handler_t)(int, void *); 74typedef irqreturn_t (*irq_handler_t)(int, void *);
63 75
64/** 76/**
@@ -71,6 +83,9 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
71 * @next: pointer to the next irqaction for shared interrupts 83 * @next: pointer to the next irqaction for shared interrupts
72 * @irq: interrupt number 84 * @irq: interrupt number
73 * @dir: pointer to the proc/irq/NN/name entry 85 * @dir: pointer to the proc/irq/NN/name entry
86 * @thread_fn: interupt handler function for threaded interrupts
87 * @thread: thread pointer for threaded interrupts
88 * @thread_flags: flags related to @thread
74 */ 89 */
75struct irqaction { 90struct irqaction {
76 irq_handler_t handler; 91 irq_handler_t handler;
@@ -81,18 +96,68 @@ struct irqaction {
81 struct irqaction *next; 96 struct irqaction *next;
82 int irq; 97 int irq;
83 struct proc_dir_entry *dir; 98 struct proc_dir_entry *dir;
99 irq_handler_t thread_fn;
100 struct task_struct *thread;
101 unsigned long thread_flags;
84}; 102};
85 103
86extern irqreturn_t no_action(int cpl, void *dev_id); 104extern irqreturn_t no_action(int cpl, void *dev_id);
87extern int __must_check request_irq(unsigned int, irq_handler_t handler, 105
88 unsigned long, const char *, void *); 106#ifdef CONFIG_GENERIC_HARDIRQS
107extern int __must_check
108request_threaded_irq(unsigned int irq, irq_handler_t handler,
109 irq_handler_t thread_fn,
110 unsigned long flags, const char *name, void *dev);
111
112static inline int __must_check
113request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
114 const char *name, void *dev)
115{
116 return request_threaded_irq(irq, handler, NULL, flags, name, dev);
117}
118
119extern void exit_irq_thread(void);
120#else
121
122extern int __must_check
123request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
124 const char *name, void *dev);
125
126/*
127 * Special function to avoid ifdeffery in kernel/irq/devres.c which
128 * gets magically built by GENERIC_HARDIRQS=n architectures (sparc,
129 * m68k). I really love these $@%#!* obvious Makefile references:
130 * ../../../kernel/irq/devres.o
131 */
132static inline int __must_check
133request_threaded_irq(unsigned int irq, irq_handler_t handler,
134 irq_handler_t thread_fn,
135 unsigned long flags, const char *name, void *dev)
136{
137 return request_irq(irq, handler, flags, name, dev);
138}
139
140static inline void exit_irq_thread(void) { }
141#endif
142
89extern void free_irq(unsigned int, void *); 143extern void free_irq(unsigned int, void *);
90 144
91struct device; 145struct device;
92 146
93extern int __must_check devm_request_irq(struct device *dev, unsigned int irq, 147extern int __must_check
94 irq_handler_t handler, unsigned long irqflags, 148devm_request_threaded_irq(struct device *dev, unsigned int irq,
95 const char *devname, void *dev_id); 149 irq_handler_t handler, irq_handler_t thread_fn,
150 unsigned long irqflags, const char *devname,
151 void *dev_id);
152
153static inline int __must_check
154devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler,
155 unsigned long irqflags, const char *devname, void *dev_id)
156{
157 return devm_request_threaded_irq(dev, irq, handler, NULL, irqflags,
158 devname, dev_id);
159}
160
96extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id); 161extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
97 162
98/* 163/*
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 974890b3c52f..ca507c9426b0 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -22,6 +22,7 @@
22#include <linux/irqnr.h> 22#include <linux/irqnr.h>
23#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/topology.h> 24#include <linux/topology.h>
25#include <linux/wait.h>
25 26
26#include <asm/irq.h> 27#include <asm/irq.h>
27#include <asm/ptrace.h> 28#include <asm/ptrace.h>
@@ -158,6 +159,8 @@ struct irq_2_iommu;
158 * @affinity: IRQ affinity on SMP 159 * @affinity: IRQ affinity on SMP
159 * @cpu: cpu index useful for balancing 160 * @cpu: cpu index useful for balancing
160 * @pending_mask: pending rebalanced interrupts 161 * @pending_mask: pending rebalanced interrupts
162 * @threads_active: number of irqaction threads currently running
163 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
161 * @dir: /proc/irq/ procfs entry 164 * @dir: /proc/irq/ procfs entry
162 * @name: flow handler name for /proc/interrupts output 165 * @name: flow handler name for /proc/interrupts output
163 */ 166 */
@@ -189,6 +192,8 @@ struct irq_desc {
189 cpumask_var_t pending_mask; 192 cpumask_var_t pending_mask;
190#endif 193#endif
191#endif 194#endif
195 atomic_t threads_active;
196 wait_queue_head_t wait_for_threads;
192#ifdef CONFIG_PROC_FS 197#ifdef CONFIG_PROC_FS
193 struct proc_dir_entry *dir; 198 struct proc_dir_entry *dir;
194#endif 199#endif
diff --git a/include/linux/irqreturn.h b/include/linux/irqreturn.h
index c5584ca5b8c9..819acaaac3f5 100644
--- a/include/linux/irqreturn.h
+++ b/include/linux/irqreturn.h
@@ -5,10 +5,12 @@
5 * enum irqreturn 5 * enum irqreturn
6 * @IRQ_NONE interrupt was not from this device 6 * @IRQ_NONE interrupt was not from this device
7 * @IRQ_HANDLED interrupt was handled by this device 7 * @IRQ_HANDLED interrupt was handled by this device
8 * @IRQ_WAKE_THREAD handler requests to wake the handler thread
8 */ 9 */
9enum irqreturn { 10enum irqreturn {
10 IRQ_NONE, 11 IRQ_NONE,
11 IRQ_HANDLED, 12 IRQ_HANDLED,
13 IRQ_WAKE_THREAD,
12}; 14};
13 15
14typedef enum irqreturn irqreturn_t; 16typedef enum irqreturn irqreturn_t;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b94f3541f67b..c96140210d1c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1294,6 +1294,11 @@ struct task_struct {
1294/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ 1294/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */
1295 spinlock_t alloc_lock; 1295 spinlock_t alloc_lock;
1296 1296
1297#ifdef CONFIG_GENERIC_HARDIRQS
1298 /* IRQ handler threads */
1299 struct irqaction *irqaction;
1300#endif
1301
1297 /* Protection of the PI data structures: */ 1302 /* Protection of the PI data structures: */
1298 spinlock_t pi_lock; 1303 spinlock_t pi_lock;
1299 1304