diff options
Diffstat (limited to 'include/linux/irq.h')
-rw-r--r-- | include/linux/irq.h | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index 8d9411bc60f6..d058c57be02d 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
19 | #include <linux/cpumask.h> | 19 | #include <linux/cpumask.h> |
20 | #include <linux/irqreturn.h> | 20 | #include <linux/irqreturn.h> |
21 | #include <linux/irqnr.h> | ||
21 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
22 | 23 | ||
23 | #include <asm/irq.h> | 24 | #include <asm/irq.h> |
@@ -152,6 +153,7 @@ struct irq_chip { | |||
152 | * @name: flow handler name for /proc/interrupts output | 153 | * @name: flow handler name for /proc/interrupts output |
153 | */ | 154 | */ |
154 | struct irq_desc { | 155 | struct irq_desc { |
156 | unsigned int irq; | ||
155 | irq_flow_handler_t handle_irq; | 157 | irq_flow_handler_t handle_irq; |
156 | struct irq_chip *chip; | 158 | struct irq_chip *chip; |
157 | struct msi_desc *msi_desc; | 159 | struct msi_desc *msi_desc; |
@@ -170,7 +172,7 @@ struct irq_desc { | |||
170 | cpumask_t affinity; | 172 | cpumask_t affinity; |
171 | unsigned int cpu; | 173 | unsigned int cpu; |
172 | #endif | 174 | #endif |
173 | #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) | 175 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
174 | cpumask_t pending_mask; | 176 | cpumask_t pending_mask; |
175 | #endif | 177 | #endif |
176 | #ifdef CONFIG_PROC_FS | 178 | #ifdef CONFIG_PROC_FS |
@@ -179,8 +181,14 @@ struct irq_desc { | |||
179 | const char *name; | 181 | const char *name; |
180 | } ____cacheline_internodealigned_in_smp; | 182 | } ____cacheline_internodealigned_in_smp; |
181 | 183 | ||
184 | |||
182 | extern struct irq_desc irq_desc[NR_IRQS]; | 185 | extern struct irq_desc irq_desc[NR_IRQS]; |
183 | 186 | ||
187 | static inline struct irq_desc *irq_to_desc(unsigned int irq) | ||
188 | { | ||
189 | return (irq < nr_irqs) ? irq_desc + irq : NULL; | ||
190 | } | ||
191 | |||
184 | /* | 192 | /* |
185 | * Migration helpers for obsolete names, they will go away: | 193 | * Migration helpers for obsolete names, they will go away: |
186 | */ | 194 | */ |
@@ -198,19 +206,15 @@ extern int setup_irq(unsigned int irq, struct irqaction *new); | |||
198 | 206 | ||
199 | #ifdef CONFIG_GENERIC_HARDIRQS | 207 | #ifdef CONFIG_GENERIC_HARDIRQS |
200 | 208 | ||
201 | #ifndef handle_dynamic_tick | ||
202 | # define handle_dynamic_tick(a) do { } while (0) | ||
203 | #endif | ||
204 | |||
205 | #ifdef CONFIG_SMP | 209 | #ifdef CONFIG_SMP |
206 | 210 | ||
207 | #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) | 211 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
208 | 212 | ||
209 | void set_pending_irq(unsigned int irq, cpumask_t mask); | 213 | void set_pending_irq(unsigned int irq, cpumask_t mask); |
210 | void move_native_irq(int irq); | 214 | void move_native_irq(int irq); |
211 | void move_masked_irq(int irq); | 215 | void move_masked_irq(int irq); |
212 | 216 | ||
213 | #else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */ | 217 | #else /* CONFIG_GENERIC_PENDING_IRQ */ |
214 | 218 | ||
215 | static inline void move_irq(int irq) | 219 | static inline void move_irq(int irq) |
216 | { | 220 | { |
@@ -237,19 +241,14 @@ static inline void set_pending_irq(unsigned int irq, cpumask_t mask) | |||
237 | 241 | ||
238 | #endif /* CONFIG_SMP */ | 242 | #endif /* CONFIG_SMP */ |
239 | 243 | ||
240 | #ifdef CONFIG_IRQBALANCE | ||
241 | extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask); | ||
242 | #else | ||
243 | static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask) | ||
244 | { | ||
245 | } | ||
246 | #endif | ||
247 | |||
248 | extern int no_irq_affinity; | 244 | extern int no_irq_affinity; |
249 | 245 | ||
250 | static inline int irq_balancing_disabled(unsigned int irq) | 246 | static inline int irq_balancing_disabled(unsigned int irq) |
251 | { | 247 | { |
252 | return irq_desc[irq].status & IRQ_NO_BALANCING_MASK; | 248 | struct irq_desc *desc; |
249 | |||
250 | desc = irq_to_desc(irq); | ||
251 | return desc->status & IRQ_NO_BALANCING_MASK; | ||
253 | } | 252 | } |
254 | 253 | ||
255 | /* Handle irq action chains: */ | 254 | /* Handle irq action chains: */ |
@@ -279,10 +278,8 @@ extern unsigned int __do_IRQ(unsigned int irq); | |||
279 | * irqchip-style controller then we call the ->handle_irq() handler, | 278 | * irqchip-style controller then we call the ->handle_irq() handler, |
280 | * and it calls __do_IRQ() if it's attached to an irqtype-style controller. | 279 | * and it calls __do_IRQ() if it's attached to an irqtype-style controller. |
281 | */ | 280 | */ |
282 | static inline void generic_handle_irq(unsigned int irq) | 281 | static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc) |
283 | { | 282 | { |
284 | struct irq_desc *desc = irq_desc + irq; | ||
285 | |||
286 | #ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ | 283 | #ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ |
287 | desc->handle_irq(irq, desc); | 284 | desc->handle_irq(irq, desc); |
288 | #else | 285 | #else |
@@ -293,6 +290,11 @@ static inline void generic_handle_irq(unsigned int irq) | |||
293 | #endif | 290 | #endif |
294 | } | 291 | } |
295 | 292 | ||
293 | static inline void generic_handle_irq(unsigned int irq) | ||
294 | { | ||
295 | generic_handle_irq_desc(irq, irq_to_desc(irq)); | ||
296 | } | ||
297 | |||
296 | /* Handling of unhandled and spurious interrupts: */ | 298 | /* Handling of unhandled and spurious interrupts: */ |
297 | extern void note_interrupt(unsigned int irq, struct irq_desc *desc, | 299 | extern void note_interrupt(unsigned int irq, struct irq_desc *desc, |
298 | int action_ret); | 300 | int action_ret); |
@@ -325,7 +327,10 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, | |||
325 | static inline void __set_irq_handler_unlocked(int irq, | 327 | static inline void __set_irq_handler_unlocked(int irq, |
326 | irq_flow_handler_t handler) | 328 | irq_flow_handler_t handler) |
327 | { | 329 | { |
328 | irq_desc[irq].handle_irq = handler; | 330 | struct irq_desc *desc; |
331 | |||
332 | desc = irq_to_desc(irq); | ||
333 | desc->handle_irq = handler; | ||
329 | } | 334 | } |
330 | 335 | ||
331 | /* | 336 | /* |
@@ -353,13 +358,14 @@ extern void set_irq_noprobe(unsigned int irq); | |||
353 | extern void set_irq_probe(unsigned int irq); | 358 | extern void set_irq_probe(unsigned int irq); |
354 | 359 | ||
355 | /* Handle dynamic irq creation and destruction */ | 360 | /* Handle dynamic irq creation and destruction */ |
361 | extern unsigned int create_irq_nr(unsigned int irq_want); | ||
356 | extern int create_irq(void); | 362 | extern int create_irq(void); |
357 | extern void destroy_irq(unsigned int irq); | 363 | extern void destroy_irq(unsigned int irq); |
358 | 364 | ||
359 | /* Test to see if a driver has successfully requested an irq */ | 365 | /* Test to see if a driver has successfully requested an irq */ |
360 | static inline int irq_has_action(unsigned int irq) | 366 | static inline int irq_has_action(unsigned int irq) |
361 | { | 367 | { |
362 | struct irq_desc *desc = irq_desc + irq; | 368 | struct irq_desc *desc = irq_to_desc(irq); |
363 | return desc->action != NULL; | 369 | return desc->action != NULL; |
364 | } | 370 | } |
365 | 371 | ||
@@ -374,10 +380,10 @@ extern int set_irq_chip_data(unsigned int irq, void *data); | |||
374 | extern int set_irq_type(unsigned int irq, unsigned int type); | 380 | extern int set_irq_type(unsigned int irq, unsigned int type); |
375 | extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | 381 | extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); |
376 | 382 | ||
377 | #define get_irq_chip(irq) (irq_desc[irq].chip) | 383 | #define get_irq_chip(irq) (irq_to_desc(irq)->chip) |
378 | #define get_irq_chip_data(irq) (irq_desc[irq].chip_data) | 384 | #define get_irq_chip_data(irq) (irq_to_desc(irq)->chip_data) |
379 | #define get_irq_data(irq) (irq_desc[irq].handler_data) | 385 | #define get_irq_data(irq) (irq_to_desc(irq)->handler_data) |
380 | #define get_irq_msi(irq) (irq_desc[irq].msi_desc) | 386 | #define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc) |
381 | 387 | ||
382 | #endif /* CONFIG_GENERIC_HARDIRQS */ | 388 | #endif /* CONFIG_GENERIC_HARDIRQS */ |
383 | 389 | ||