Commit d7e51e66899f95dabc89b4d4c6674a6e50fa37fc

Authored by Yinghai Lu
Committed by Ingo Molnar
1 parent e8b722f487

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>

Showing 5 changed files with 11 additions and 12 deletions Side-by-side Diff

drivers/char/random.c
... ... @@ -558,7 +558,7 @@
558 558 unsigned dont_count_entropy:1;
559 559 };
560 560  
561   -#ifndef CONFIG_SPARSE_IRQ
  561 +#ifndef CONFIG_GENERIC_HARDIRQS
562 562  
563 563 static struct timer_rand_state *irq_timer_state[NR_IRQS];
564 564  
drivers/pci/intr_remapping.c
... ... @@ -20,7 +20,7 @@
20 20 u8 irte_mask;
21 21 };
22 22  
23   -#ifdef CONFIG_SPARSE_IRQ
  23 +#ifdef CONFIG_GENERIC_HARDIRQS
24 24 static struct irq_2_iommu *get_one_free_irq_2_iommu(int cpu)
25 25 {
26 26 struct irq_2_iommu *iommu;
... ... @@ -160,12 +160,10 @@
160 160 */
161 161 struct irq_desc {
162 162 unsigned int irq;
163   -#ifdef CONFIG_SPARSE_IRQ
164 163 struct timer_rand_state *timer_rand_state;
165 164 unsigned int *kstat_irqs;
166   -# ifdef CONFIG_INTR_REMAP
  165 +#ifdef CONFIG_INTR_REMAP
167 166 struct irq_2_iommu *irq_2_iommu;
168   -# endif
169 167 #endif
170 168 irq_flow_handler_t handle_irq;
171 169 struct irq_chip *chip;
172 170  
... ... @@ -202,13 +200,13 @@
202 200 extern struct irq_desc irq_desc[NR_IRQS];
203 201 #else /* CONFIG_SPARSE_IRQ */
204 202 extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu);
  203 +#endif /* CONFIG_SPARSE_IRQ */
205 204  
206 205 #define kstat_irqs_this_cpu(DESC) \
207 206 ((DESC)->kstat_irqs[smp_processor_id()])
208 207 #define kstat_incr_irqs_this_cpu(irqno, DESC) \
209 208 ((DESC)->kstat_irqs[smp_processor_id()]++)
210 209  
211   -#endif /* CONFIG_SPARSE_IRQ */
212 210  
213 211 extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
214 212  
include/linux/kernel_stat.h
... ... @@ -28,7 +28,7 @@
28 28  
29 29 struct kernel_stat {
30 30 struct cpu_usage_stat cpustat;
31   -#ifndef CONFIG_SPARSE_IRQ
  31 +#ifndef CONFIG_GENERIC_HARDIRQS
32 32 unsigned int irqs[NR_IRQS];
33 33 #endif
34 34 };
... ... @@ -41,7 +41,7 @@
41 41  
42 42 extern unsigned long long nr_context_switches(void);
43 43  
44   -#ifndef CONFIG_SPARSE_IRQ
  44 +#ifndef CONFIG_GENERIC_HARDIRQS
45 45 #define kstat_irqs_this_cpu(irq) \
46 46 (kstat_this_cpu.irqs[irq])
47 47  
... ... @@ -55,7 +55,7 @@
55 55 #endif
56 56  
57 57  
58   -#ifndef CONFIG_SPARSE_IRQ
  58 +#ifndef CONFIG_GENERIC_HARDIRQS
59 59 static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
60 60 {
61 61 return kstat_cpu(cpu).irqs[irq];
... ... @@ -213,6 +213,7 @@
213 213 }
214 214 };
215 215  
  216 +static unsigned int kstat_irqs_all[NR_IRQS][NR_CPUS];
216 217 int __init early_irq_init(void)
217 218 {
218 219 struct irq_desc *desc;
219 220  
... ... @@ -222,8 +223,10 @@
222 223 desc = irq_desc;
223 224 count = ARRAY_SIZE(irq_desc);
224 225  
225   - for (i = 0; i < count; i++)
  226 + for (i = 0; i < count; i++) {
226 227 desc[i].irq = i;
  228 + desc[i].kstat_irqs = kstat_irqs_all[i];
  229 + }
227 230  
228 231 return arch_early_irq_init();
229 232 }
230 233  
... ... @@ -451,12 +454,10 @@
451 454 }
452 455 }
453 456  
454   -#ifdef CONFIG_SPARSE_IRQ
455 457 unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
456 458 {
457 459 struct irq_desc *desc = irq_to_desc(irq);
458 460 return desc ? desc->kstat_irqs[cpu] : 0;
459 461 }
460   -#endif
461 462 EXPORT_SYMBOL(kstat_irqs_cpu);