aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/stat.c20
-rw-r--r--include/linux/irq.h9
-rw-r--r--include/linux/irqnr.h19
3 files changed, 29 insertions, 19 deletions
diff --git a/fs/proc/stat.c b/fs/proc/stat.c
index a13431ab7c65..3cb9492801c0 100644
--- a/fs/proc/stat.c
+++ b/fs/proc/stat.c
@@ -45,9 +45,12 @@ static int show_stat(struct seq_file *p, void *v)
45 softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); 45 softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
46 steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); 46 steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
47 guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest); 47 guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
48 for_each_irq_desc(j, desc) { 48 for_each_irq_nr(j) {
49#ifdef CONFIG_SPARSE_IRQ
50 desc = irq_to_desc(j);
49 if (!desc) 51 if (!desc)
50 continue; 52 continue;
53#endif
51 sum += kstat_irqs_cpu(j, i); 54 sum += kstat_irqs_cpu(j, i);
52 } 55 }
53 sum += arch_irq_stat_cpu(i); 56 sum += arch_irq_stat_cpu(i);
@@ -92,14 +95,17 @@ static int show_stat(struct seq_file *p, void *v)
92 seq_printf(p, "intr %llu", (unsigned long long)sum); 95 seq_printf(p, "intr %llu", (unsigned long long)sum);
93 96
94 /* sum again ? it could be updated? */ 97 /* sum again ? it could be updated? */
95 for (j = 0; j < NR_IRQS; j++) { 98 for_each_irq_nr(j) {
96 desc = irq_to_desc(j);
97 per_irq_sum = 0; 99 per_irq_sum = 0;
98 100#ifdef CONFIG_SPARSE_IRQ
99 if (desc) { 101 desc = irq_to_desc(j);
100 for_each_possible_cpu(i) 102 if (!desc) {
101 per_irq_sum += kstat_irqs_cpu(j, i); 103 seq_printf(p, " %u", per_irq_sum);
104 continue;
102 } 105 }
106#endif
107 for_each_possible_cpu(i)
108 per_irq_sum += kstat_irqs_cpu(j, i);
103 109
104 seq_printf(p, " %u", per_irq_sum); 110 seq_printf(p, " %u", per_irq_sum);
105 } 111 }
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 63b00439d4d2..b5749db3e5a1 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -198,7 +198,6 @@ extern void arch_init_copy_chip_data(struct irq_desc *old_desc,
198extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc); 198extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc);
199 199
200#ifndef CONFIG_SPARSE_IRQ 200#ifndef CONFIG_SPARSE_IRQ
201
202extern struct irq_desc irq_desc[NR_IRQS]; 201extern struct irq_desc irq_desc[NR_IRQS];
203 202
204static inline struct irq_desc *irq_to_desc(unsigned int irq) 203static inline struct irq_desc *irq_to_desc(unsigned int irq)
@@ -210,14 +209,6 @@ static inline struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
210 return irq_to_desc(irq); 209 return irq_to_desc(irq);
211} 210}
212 211
213#ifdef CONFIG_GENERIC_HARDIRQS
214# define for_each_irq_desc(irq, desc) \
215 for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++)
216# define for_each_irq_desc_reverse(irq, desc) \
217 for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \
218 irq >= 0; irq--, desc--)
219#endif
220
221#else 212#else
222 213
223extern struct irq_desc *irq_to_desc(unsigned int irq); 214extern struct irq_desc *irq_to_desc(unsigned int irq);
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index 7a299e989f8b..13754f813589 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -8,9 +8,22 @@
8# define for_each_irq_desc(irq, desc) \ 8# define for_each_irq_desc(irq, desc) \
9 for (irq = 0; irq < nr_irqs; irq++) 9 for (irq = 0; irq < nr_irqs; irq++)
10 10
11static inline early_sparse_irq_init(void) 11# define for_each_irq_desc_reverse(irq, desc) \
12{ 12 for (irq = nr_irqs - 1; irq >= 0; irq--)
13} 13#else
14#ifndef CONFIG_SPARSE_IRQ
15
16struct irq_desc;
17extern int nr_irqs;
18# define for_each_irq_desc(irq, desc) \
19 for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++)
20# define for_each_irq_desc_reverse(irq, desc) \
21 for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \
22 irq >= 0; irq--, desc--)
14#endif 23#endif
24#endif
25
26#define for_each_irq_nr(irq) \
27 for (irq = 0; irq < nr_irqs; irq++)
15 28
16#endif 29#endif