diff options
author | Yinghai Lu <yinghai@kernel.org> | 2009-01-07 18:03:13 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-10 22:46:26 -0500 |
commit | d7e51e66899f95dabc89b4d4c6674a6e50fa37fc (patch) | |
tree | 5b4cc72a4e411d6962ce9ce7258abf2bac0204d4 | |
parent | e8b722f487589a1f60ca27adc695494f188d404e (diff) |
sparseirq: make some func to be used with genirq
Impact: clean up sparseirq fallout on random.c
Ingo suggested to change some ifdef from SPARSE_IRQ to GENERIC_HARDIRQS
so we could some #ifdef later if all arch support genirq
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | drivers/char/random.c | 2 | ||||
-rw-r--r-- | drivers/pci/intr_remapping.c | 2 | ||||
-rw-r--r-- | include/linux/irq.h | 6 | ||||
-rw-r--r-- | include/linux/kernel_stat.h | 6 | ||||
-rw-r--r-- | kernel/irq/handle.c | 7 |
5 files changed, 11 insertions, 12 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 7c13581ca9cd..a778918c8f42 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -558,7 +558,7 @@ struct timer_rand_state { | |||
558 | unsigned dont_count_entropy:1; | 558 | unsigned dont_count_entropy:1; |
559 | }; | 559 | }; |
560 | 560 | ||
561 | #ifndef CONFIG_SPARSE_IRQ | 561 | #ifndef CONFIG_GENERIC_HARDIRQS |
562 | 562 | ||
563 | static struct timer_rand_state *irq_timer_state[NR_IRQS]; | 563 | static struct timer_rand_state *irq_timer_state[NR_IRQS]; |
564 | 564 | ||
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c index f78371b22529..3d604132a04f 100644 --- a/drivers/pci/intr_remapping.c +++ b/drivers/pci/intr_remapping.c | |||
@@ -20,7 +20,7 @@ struct irq_2_iommu { | |||
20 | u8 irte_mask; | 20 | u8 irte_mask; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | #ifdef CONFIG_SPARSE_IRQ | 23 | #ifdef CONFIG_GENERIC_HARDIRQS |
24 | static struct irq_2_iommu *get_one_free_irq_2_iommu(int cpu) | 24 | static struct irq_2_iommu *get_one_free_irq_2_iommu(int cpu) |
25 | { | 25 | { |
26 | struct irq_2_iommu *iommu; | 26 | struct irq_2_iommu *iommu; |
diff --git a/include/linux/irq.h b/include/linux/irq.h index f899b502f186..e9a878978c85 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -160,12 +160,10 @@ struct irq_2_iommu; | |||
160 | */ | 160 | */ |
161 | struct irq_desc { | 161 | struct irq_desc { |
162 | unsigned int irq; | 162 | unsigned int irq; |
163 | #ifdef CONFIG_SPARSE_IRQ | ||
164 | struct timer_rand_state *timer_rand_state; | 163 | struct timer_rand_state *timer_rand_state; |
165 | unsigned int *kstat_irqs; | 164 | unsigned int *kstat_irqs; |
166 | # ifdef CONFIG_INTR_REMAP | 165 | #ifdef CONFIG_INTR_REMAP |
167 | struct irq_2_iommu *irq_2_iommu; | 166 | struct irq_2_iommu *irq_2_iommu; |
168 | # endif | ||
169 | #endif | 167 | #endif |
170 | irq_flow_handler_t handle_irq; | 168 | irq_flow_handler_t handle_irq; |
171 | struct irq_chip *chip; | 169 | struct irq_chip *chip; |
@@ -202,13 +200,13 @@ extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc | |||
202 | extern struct irq_desc irq_desc[NR_IRQS]; | 200 | extern struct irq_desc irq_desc[NR_IRQS]; |
203 | #else /* CONFIG_SPARSE_IRQ */ | 201 | #else /* CONFIG_SPARSE_IRQ */ |
204 | extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); | 202 | extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); |
203 | #endif /* CONFIG_SPARSE_IRQ */ | ||
205 | 204 | ||
206 | #define kstat_irqs_this_cpu(DESC) \ | 205 | #define kstat_irqs_this_cpu(DESC) \ |
207 | ((DESC)->kstat_irqs[smp_processor_id()]) | 206 | ((DESC)->kstat_irqs[smp_processor_id()]) |
208 | #define kstat_incr_irqs_this_cpu(irqno, DESC) \ | 207 | #define kstat_incr_irqs_this_cpu(irqno, DESC) \ |
209 | ((DESC)->kstat_irqs[smp_processor_id()]++) | 208 | ((DESC)->kstat_irqs[smp_processor_id()]++) |
210 | 209 | ||
211 | #endif /* CONFIG_SPARSE_IRQ */ | ||
212 | 210 | ||
213 | extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); | 211 | extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); |
214 | 212 | ||
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 570d20413119..a3431b164bea 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
@@ -28,7 +28,7 @@ struct cpu_usage_stat { | |||
28 | 28 | ||
29 | struct kernel_stat { | 29 | struct kernel_stat { |
30 | struct cpu_usage_stat cpustat; | 30 | struct cpu_usage_stat cpustat; |
31 | #ifndef CONFIG_SPARSE_IRQ | 31 | #ifndef CONFIG_GENERIC_HARDIRQS |
32 | unsigned int irqs[NR_IRQS]; | 32 | unsigned int irqs[NR_IRQS]; |
33 | #endif | 33 | #endif |
34 | }; | 34 | }; |
@@ -41,7 +41,7 @@ DECLARE_PER_CPU(struct kernel_stat, kstat); | |||
41 | 41 | ||
42 | extern unsigned long long nr_context_switches(void); | 42 | extern unsigned long long nr_context_switches(void); |
43 | 43 | ||
44 | #ifndef CONFIG_SPARSE_IRQ | 44 | #ifndef CONFIG_GENERIC_HARDIRQS |
45 | #define kstat_irqs_this_cpu(irq) \ | 45 | #define kstat_irqs_this_cpu(irq) \ |
46 | (kstat_this_cpu.irqs[irq]) | 46 | (kstat_this_cpu.irqs[irq]) |
47 | 47 | ||
@@ -55,7 +55,7 @@ static inline void kstat_incr_irqs_this_cpu(unsigned int irq, | |||
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | 57 | ||
58 | #ifndef CONFIG_SPARSE_IRQ | 58 | #ifndef CONFIG_GENERIC_HARDIRQS |
59 | static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | 59 | static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) |
60 | { | 60 | { |
61 | return kstat_cpu(cpu).irqs[irq]; | 61 | return kstat_cpu(cpu).irqs[irq]; |
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index c20db0be9173..48299a8a22f8 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -213,6 +213,7 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { | |||
213 | } | 213 | } |
214 | }; | 214 | }; |
215 | 215 | ||
216 | static unsigned int kstat_irqs_all[NR_IRQS][NR_CPUS]; | ||
216 | int __init early_irq_init(void) | 217 | int __init early_irq_init(void) |
217 | { | 218 | { |
218 | struct irq_desc *desc; | 219 | struct irq_desc *desc; |
@@ -222,8 +223,10 @@ int __init early_irq_init(void) | |||
222 | desc = irq_desc; | 223 | desc = irq_desc; |
223 | count = ARRAY_SIZE(irq_desc); | 224 | count = ARRAY_SIZE(irq_desc); |
224 | 225 | ||
225 | for (i = 0; i < count; i++) | 226 | for (i = 0; i < count; i++) { |
226 | desc[i].irq = i; | 227 | desc[i].irq = i; |
228 | desc[i].kstat_irqs = kstat_irqs_all[i]; | ||
229 | } | ||
227 | 230 | ||
228 | return arch_early_irq_init(); | 231 | return arch_early_irq_init(); |
229 | } | 232 | } |
@@ -451,12 +454,10 @@ void early_init_irq_lock_class(void) | |||
451 | } | 454 | } |
452 | } | 455 | } |
453 | 456 | ||
454 | #ifdef CONFIG_SPARSE_IRQ | ||
455 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | 457 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) |
456 | { | 458 | { |
457 | struct irq_desc *desc = irq_to_desc(irq); | 459 | struct irq_desc *desc = irq_to_desc(irq); |
458 | return desc ? desc->kstat_irqs[cpu] : 0; | 460 | return desc ? desc->kstat_irqs[cpu] : 0; |
459 | } | 461 | } |
460 | #endif | ||
461 | EXPORT_SYMBOL(kstat_irqs_cpu); | 462 | EXPORT_SYMBOL(kstat_irqs_cpu); |
462 | 463 | ||