diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-07 17:07:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-07 17:07:52 -0400 |
commit | c61b79b6ef266890954213a701d8f6021d8c1289 (patch) | |
tree | 9b000a7dae5a782a0d667137ab43e4f1bea70d58 /include/linux/interrupt.h | |
parent | 2b2ec7554cf7ec5e4412f89a5af6abe8ce950700 (diff) | |
parent | 9efe21cb82b5dbe3b0b2ae4de4eccc64ecb94e95 (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/linux/interrupt.h')
-rw-r--r-- | include/linux/interrupt.h | 75 |
1 files changed, 70 insertions, 5 deletions
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 | */ | ||
68 | enum { | ||
69 | IRQTF_RUNTHREAD, | ||
70 | IRQTF_DIED, | ||
71 | IRQTF_WARNED, | ||
72 | }; | ||
73 | |||
62 | typedef irqreturn_t (*irq_handler_t)(int, void *); | 74 | typedef 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 | */ |
75 | struct irqaction { | 90 | struct 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 | ||
86 | extern irqreturn_t no_action(int cpl, void *dev_id); | 104 | extern irqreturn_t no_action(int cpl, void *dev_id); |
87 | extern int __must_check request_irq(unsigned int, irq_handler_t handler, | 105 | |
88 | unsigned long, const char *, void *); | 106 | #ifdef CONFIG_GENERIC_HARDIRQS |
107 | extern int __must_check | ||
108 | request_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 | |||
112 | static inline int __must_check | ||
113 | request_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 | |||
119 | extern void exit_irq_thread(void); | ||
120 | #else | ||
121 | |||
122 | extern int __must_check | ||
123 | request_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 | */ | ||
132 | static inline int __must_check | ||
133 | request_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 | |||
140 | static inline void exit_irq_thread(void) { } | ||
141 | #endif | ||
142 | |||
89 | extern void free_irq(unsigned int, void *); | 143 | extern void free_irq(unsigned int, void *); |
90 | 144 | ||
91 | struct device; | 145 | struct device; |
92 | 146 | ||
93 | extern int __must_check devm_request_irq(struct device *dev, unsigned int irq, | 147 | extern int __must_check |
94 | irq_handler_t handler, unsigned long irqflags, | 148 | devm_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 | |||
153 | static inline int __must_check | ||
154 | devm_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 | |||
96 | extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id); | 161 | extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id); |
97 | 162 | ||
98 | /* | 163 | /* |