diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-08-19 23:50:05 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:52:29 -0400 |
commit | 08678b0841267c1d00d771fe01548d86043d065e (patch) | |
tree | 7debb21f9e9a768ced43077f7376797a0c46f8c0 /include/linux/irq.h | |
parent | bfea1238beac9d306eeac081c67de5ca6aec4c7a (diff) |
generic: sparse irqs: use irq_desc() together with dyn_array, instead of irq_desc[]
add CONFIG_HAVE_SPARSE_IRQ to for use condensed array.
Get rid of irq_desc[] array assumptions.
Preallocate 32 irq_desc, and irq_desc() will try to get more.
( No change in functionality is expected anywhere, except the odd build
failure where we missed a code site or where a crossing commit itroduces
new irq_desc[] usage. )
v2: according to Eric, change get_irq_desc() to irq_desc()
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/irq.h')
-rw-r--r-- | include/linux/irq.h | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index 5f4b013624dc..80b8200f2adb 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -152,6 +152,10 @@ struct irq_chip { | |||
152 | * @name: flow handler name for /proc/interrupts output | 152 | * @name: flow handler name for /proc/interrupts output |
153 | */ | 153 | */ |
154 | struct irq_desc { | 154 | struct irq_desc { |
155 | unsigned int irq; | ||
156 | #ifdef CONFIG_HAVE_SPARSE_IRQ | ||
157 | struct irq_desc *next; | ||
158 | #endif | ||
155 | irq_flow_handler_t handle_irq; | 159 | irq_flow_handler_t handle_irq; |
156 | struct irq_chip *chip; | 160 | struct irq_chip *chip; |
157 | struct msi_desc *msi_desc; | 161 | struct msi_desc *msi_desc; |
@@ -179,9 +183,9 @@ struct irq_desc { | |||
179 | const char *name; | 183 | const char *name; |
180 | } ____cacheline_internodealigned_in_smp; | 184 | } ____cacheline_internodealigned_in_smp; |
181 | 185 | ||
182 | #ifdef CONFIG_HAVE_DYN_ARRAY | 186 | extern struct irq_desc *irq_to_desc(unsigned int irq); |
183 | extern struct irq_desc *irq_desc; | 187 | #ifndef CONFIG_HAVE_DYN_ARRAY |
184 | #else | 188 | /* could be removed if we get rid of all irq_desc reference */ |
185 | extern struct irq_desc irq_desc[NR_IRQS]; | 189 | extern struct irq_desc irq_desc[NR_IRQS]; |
186 | #endif | 190 | #endif |
187 | 191 | ||
@@ -249,7 +253,10 @@ extern int no_irq_affinity; | |||
249 | 253 | ||
250 | static inline int irq_balancing_disabled(unsigned int irq) | 254 | static inline int irq_balancing_disabled(unsigned int irq) |
251 | { | 255 | { |
252 | return irq_desc[irq].status & IRQ_NO_BALANCING_MASK; | 256 | struct irq_desc *desc; |
257 | |||
258 | desc = irq_to_desc(irq); | ||
259 | return desc->status & IRQ_NO_BALANCING_MASK; | ||
253 | } | 260 | } |
254 | 261 | ||
255 | /* Handle irq action chains: */ | 262 | /* Handle irq action chains: */ |
@@ -281,7 +288,7 @@ extern unsigned int __do_IRQ(unsigned int irq); | |||
281 | */ | 288 | */ |
282 | static inline void generic_handle_irq(unsigned int irq) | 289 | static inline void generic_handle_irq(unsigned int irq) |
283 | { | 290 | { |
284 | struct irq_desc *desc = irq_desc + irq; | 291 | struct irq_desc *desc = irq_to_desc(irq); |
285 | 292 | ||
286 | #ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ | 293 | #ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ |
287 | desc->handle_irq(irq, desc); | 294 | desc->handle_irq(irq, desc); |
@@ -325,7 +332,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, | 332 | static inline void __set_irq_handler_unlocked(int irq, |
326 | irq_flow_handler_t handler) | 333 | irq_flow_handler_t handler) |
327 | { | 334 | { |
328 | irq_desc[irq].handle_irq = handler; | 335 | struct irq_desc *desc; |
336 | |||
337 | desc = irq_to_desc(irq); | ||
338 | desc->handle_irq = handler; | ||
329 | } | 339 | } |
330 | 340 | ||
331 | /* | 341 | /* |
@@ -359,7 +369,7 @@ extern void destroy_irq(unsigned int irq); | |||
359 | /* Test to see if a driver has successfully requested an irq */ | 369 | /* Test to see if a driver has successfully requested an irq */ |
360 | static inline int irq_has_action(unsigned int irq) | 370 | static inline int irq_has_action(unsigned int irq) |
361 | { | 371 | { |
362 | struct irq_desc *desc = irq_desc + irq; | 372 | struct irq_desc *desc = irq_to_desc(irq); |
363 | return desc->action != NULL; | 373 | return desc->action != NULL; |
364 | } | 374 | } |
365 | 375 | ||
@@ -374,10 +384,10 @@ extern int set_irq_chip_data(unsigned int irq, void *data); | |||
374 | extern int set_irq_type(unsigned int irq, unsigned int type); | 384 | extern int set_irq_type(unsigned int irq, unsigned int type); |
375 | extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | 385 | extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); |
376 | 386 | ||
377 | #define get_irq_chip(irq) (irq_desc[irq].chip) | 387 | #define get_irq_chip(irq) (irq_to_desc(irq)->chip) |
378 | #define get_irq_chip_data(irq) (irq_desc[irq].chip_data) | 388 | #define get_irq_chip_data(irq) (irq_to_desc(irq)->chip_data) |
379 | #define get_irq_data(irq) (irq_desc[irq].handler_data) | 389 | #define get_irq_data(irq) (irq_to_desc(irq)->handler_data) |
380 | #define get_irq_msi(irq) (irq_desc[irq].msi_desc) | 390 | #define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc) |
381 | 391 | ||
382 | #endif /* CONFIG_GENERIC_HARDIRQS */ | 392 | #endif /* CONFIG_GENERIC_HARDIRQS */ |
383 | 393 | ||