diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2008-12-25 22:24:24 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-26 03:48:17 -0500 |
commit | f9af0e70911e9d6cc9a68f784dca86415486084d (patch) | |
tree | 58a83c34cc8a511b5e05d48425251621e9b471a1 /include/linux | |
parent | 51bc39f4ba35bae153b32145077fb1109bcae14c (diff) |
irq: for_each_irq_desc() move to irqnr.h
Impact: cleanup
before CONFIG_SPARSE_IRQ age, for_each_irq_desc() sat in irqnr.h and
could be called from generic code.
CONFIG_SPARSE_IRQ breaks this assumption, but SPARSE_IRQ version
for_each_irq_desc() also can move into irqnr.h easily.
Also, this patch unifies CONFIG_SPARSE_IRQ and !CONFIG_SPARSE_IRQ
for_each_irq_desc().
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/irq.h | 24 | ||||
-rw-r--r-- | include/linux/irqnr.h | 19 |
2 files changed, 13 insertions, 30 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index 98564dc64476..69da275c0ebd 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -202,33 +202,17 @@ extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc | |||
202 | 202 | ||
203 | #ifndef CONFIG_SPARSE_IRQ | 203 | #ifndef CONFIG_SPARSE_IRQ |
204 | extern struct irq_desc irq_desc[NR_IRQS]; | 204 | extern struct irq_desc irq_desc[NR_IRQS]; |
205 | 205 | #else /* CONFIG_SPARSE_IRQ */ | |
206 | static inline struct irq_desc *irq_to_desc(unsigned int irq) | ||
207 | { | ||
208 | return (irq < NR_IRQS) ? irq_desc + irq : NULL; | ||
209 | } | ||
210 | static inline struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) | ||
211 | { | ||
212 | return irq_to_desc(irq); | ||
213 | } | ||
214 | |||
215 | #else | ||
216 | |||
217 | extern struct irq_desc *irq_to_desc(unsigned int irq); | ||
218 | extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); | ||
219 | extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); | 206 | extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); |
220 | 207 | ||
221 | # define for_each_irq_desc(irq, desc) \ | ||
222 | for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq)) | ||
223 | # define for_each_irq_desc_reverse(irq, desc) \ | ||
224 | for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq)) | ||
225 | |||
226 | #define kstat_irqs_this_cpu(DESC) \ | 208 | #define kstat_irqs_this_cpu(DESC) \ |
227 | ((DESC)->kstat_irqs[smp_processor_id()]) | 209 | ((DESC)->kstat_irqs[smp_processor_id()]) |
228 | #define kstat_incr_irqs_this_cpu(irqno, DESC) \ | 210 | #define kstat_incr_irqs_this_cpu(irqno, DESC) \ |
229 | ((DESC)->kstat_irqs[smp_processor_id()]++) | 211 | ((DESC)->kstat_irqs[smp_processor_id()]++) |
230 | 212 | ||
231 | #endif | 213 | #endif /* CONFIG_SPARSE_IRQ */ |
214 | |||
215 | extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); | ||
232 | 216 | ||
233 | static inline struct irq_desc * | 217 | static inline struct irq_desc * |
234 | irq_remap_to_desc(unsigned int irq, struct irq_desc *desc) | 218 | irq_remap_to_desc(unsigned int irq, struct irq_desc *desc) |
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h index 95d2b74641f5..c4a59c7a478b 100644 --- a/include/linux/irqnr.h +++ b/include/linux/irqnr.h | |||
@@ -15,20 +15,19 @@ | |||
15 | 15 | ||
16 | # define for_each_irq_desc_reverse(irq, desc) \ | 16 | # define for_each_irq_desc_reverse(irq, desc) \ |
17 | for (irq = nr_irqs - 1; irq >= 0; irq--) | 17 | for (irq = nr_irqs - 1; irq >= 0; irq--) |
18 | #else | 18 | #else /* CONFIG_GENERIC_HARDIRQS */ |
19 | 19 | ||
20 | extern int nr_irqs; | 20 | extern int nr_irqs; |
21 | extern struct irq_desc *irq_to_desc(unsigned int irq); | ||
21 | 22 | ||
22 | #ifndef CONFIG_SPARSE_IRQ | 23 | # define for_each_irq_desc(irq, desc) \ |
24 | for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ | ||
25 | irq++, desc = irq_to_desc(irq)) | ||
26 | # define for_each_irq_desc_reverse(irq, desc) \ | ||
27 | for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ | ||
28 | irq--, desc = irq_to_desc(irq)) | ||
23 | 29 | ||
24 | struct irq_desc; | 30 | #endif /* CONFIG_GENERIC_HARDIRQS */ |
25 | # define for_each_irq_desc(irq, desc) \ | ||
26 | for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) | ||
27 | # define for_each_irq_desc_reverse(irq, desc) \ | ||
28 | for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ | ||
29 | irq >= 0; irq--, desc--) | ||
30 | #endif | ||
31 | #endif | ||
32 | 31 | ||
33 | #define for_each_irq_nr(irq) \ | 32 | #define for_each_irq_nr(irq) \ |
34 | for (irq = 0; irq < nr_irqs; irq++) | 33 | for (irq = 0; irq < nr_irqs; irq++) |