diff options
-rw-r--r-- | drivers/xen/events.c | 14 | ||||
-rw-r--r-- | kernel/irq/autoprobe.c | 45 | ||||
-rw-r--r-- | kernel/irq/handle.c | 5 |
3 files changed, 21 insertions, 43 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index e6d47e8ca1ac..9ce1ab6c268d 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -137,14 +137,12 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu) | |||
137 | static void init_evtchn_cpu_bindings(void) | 137 | static void init_evtchn_cpu_bindings(void) |
138 | { | 138 | { |
139 | #ifdef CONFIG_SMP | 139 | #ifdef CONFIG_SMP |
140 | struct irq_desc *desc; | ||
140 | int i; | 141 | int i; |
142 | |||
141 | /* By default all event channels notify CPU#0. */ | 143 | /* By default all event channels notify CPU#0. */ |
142 | for (i = 0; i < nr_irqs; i++) { | 144 | for_each_irq_desc(i, desc) |
143 | struct irq_desc *desc = irq_to_desc(i); | ||
144 | if (!desc) | ||
145 | continue; | ||
146 | desc->affinity = cpumask_of_cpu(0); | 145 | desc->affinity = cpumask_of_cpu(0); |
147 | } | ||
148 | #endif | 146 | #endif |
149 | 147 | ||
150 | memset(cpu_evtchn, 0, sizeof(cpu_evtchn)); | 148 | memset(cpu_evtchn, 0, sizeof(cpu_evtchn)); |
@@ -233,7 +231,7 @@ static int find_unbound_irq(void) | |||
233 | int irq; | 231 | int irq; |
234 | 232 | ||
235 | /* Only allocate from dynirq range */ | 233 | /* Only allocate from dynirq range */ |
236 | for (irq = 0; irq < nr_irqs; irq++) | 234 | for_each_irq_nr(irq) |
237 | if (irq_bindcount[irq] == 0) | 235 | if (irq_bindcount[irq] == 0) |
238 | break; | 236 | break; |
239 | 237 | ||
@@ -794,7 +792,7 @@ void xen_irq_resume(void) | |||
794 | mask_evtchn(evtchn); | 792 | mask_evtchn(evtchn); |
795 | 793 | ||
796 | /* No IRQ <-> event-channel mappings. */ | 794 | /* No IRQ <-> event-channel mappings. */ |
797 | for (irq = 0; irq < nr_irqs; irq++) | 795 | for_each_irq_nr(irq) |
798 | irq_info[irq].evtchn = 0; /* zap event-channel binding */ | 796 | irq_info[irq].evtchn = 0; /* zap event-channel binding */ |
799 | 797 | ||
800 | for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) | 798 | for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) |
@@ -826,7 +824,7 @@ void __init xen_init_IRQ(void) | |||
826 | mask_evtchn(i); | 824 | mask_evtchn(i); |
827 | 825 | ||
828 | /* Dynamic IRQ space is currently unbound. Zero the refcnts. */ | 826 | /* Dynamic IRQ space is currently unbound. Zero the refcnts. */ |
829 | for (i = 0; i < nr_irqs; i++) | 827 | for_each_irq_nr(i) |
830 | irq_bindcount[i] = 0; | 828 | irq_bindcount[i] = 0; |
831 | 829 | ||
832 | irq_ctx_init(smp_processor_id()); | 830 | irq_ctx_init(smp_processor_id()); |
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c index b3a5549ea81e..0cbff18efb6d 100644 --- a/kernel/irq/autoprobe.c +++ b/kernel/irq/autoprobe.c | |||
@@ -30,19 +30,16 @@ static DEFINE_MUTEX(probing_active); | |||
30 | unsigned long probe_irq_on(void) | 30 | unsigned long probe_irq_on(void) |
31 | { | 31 | { |
32 | struct irq_desc *desc; | 32 | struct irq_desc *desc; |
33 | unsigned long mask; | 33 | unsigned long mask = 0; |
34 | unsigned int i; | 34 | unsigned int status; |
35 | int i; | ||
35 | 36 | ||
36 | mutex_lock(&probing_active); | 37 | mutex_lock(&probing_active); |
37 | /* | 38 | /* |
38 | * something may have generated an irq long ago and we want to | 39 | * something may have generated an irq long ago and we want to |
39 | * flush such a longstanding irq before considering it as spurious. | 40 | * flush such a longstanding irq before considering it as spurious. |
40 | */ | 41 | */ |
41 | for (i = nr_irqs-1; i > 0; i--) { | 42 | for_each_irq_desc_reverse(i, desc) { |
42 | desc = irq_to_desc(i); | ||
43 | if (!desc) | ||
44 | continue; | ||
45 | |||
46 | spin_lock_irq(&desc->lock); | 43 | spin_lock_irq(&desc->lock); |
47 | if (!desc->action && !(desc->status & IRQ_NOPROBE)) { | 44 | if (!desc->action && !(desc->status & IRQ_NOPROBE)) { |
48 | /* | 45 | /* |
@@ -70,11 +67,7 @@ unsigned long probe_irq_on(void) | |||
70 | * (we must startup again here because if a longstanding irq | 67 | * (we must startup again here because if a longstanding irq |
71 | * happened in the previous stage, it may have masked itself) | 68 | * happened in the previous stage, it may have masked itself) |
72 | */ | 69 | */ |
73 | for (i = nr_irqs-1; i > 0; i--) { | 70 | for_each_irq_desc_reverse(i, desc) { |
74 | desc = irq_to_desc(i); | ||
75 | if (!desc) | ||
76 | continue; | ||
77 | |||
78 | spin_lock_irq(&desc->lock); | 71 | spin_lock_irq(&desc->lock); |
79 | if (!desc->action && !(desc->status & IRQ_NOPROBE)) { | 72 | if (!desc->action && !(desc->status & IRQ_NOPROBE)) { |
80 | desc->status |= IRQ_AUTODETECT | IRQ_WAITING; | 73 | desc->status |= IRQ_AUTODETECT | IRQ_WAITING; |
@@ -92,13 +85,7 @@ unsigned long probe_irq_on(void) | |||
92 | /* | 85 | /* |
93 | * Now filter out any obviously spurious interrupts | 86 | * Now filter out any obviously spurious interrupts |
94 | */ | 87 | */ |
95 | mask = 0; | 88 | for_each_irq_desc(i, desc) { |
96 | for (i = 0; i < nr_irqs; i++) { | ||
97 | unsigned int status; | ||
98 | |||
99 | desc = irq_to_desc(i); | ||
100 | if (!desc) | ||
101 | continue; | ||
102 | spin_lock_irq(&desc->lock); | 89 | spin_lock_irq(&desc->lock); |
103 | status = desc->status; | 90 | status = desc->status; |
104 | 91 | ||
@@ -132,16 +119,11 @@ EXPORT_SYMBOL(probe_irq_on); | |||
132 | */ | 119 | */ |
133 | unsigned int probe_irq_mask(unsigned long val) | 120 | unsigned int probe_irq_mask(unsigned long val) |
134 | { | 121 | { |
135 | unsigned int mask; | 122 | unsigned int status, mask = 0; |
123 | struct irq_desc *desc; | ||
136 | int i; | 124 | int i; |
137 | 125 | ||
138 | mask = 0; | 126 | for_each_irq_desc(i, desc) { |
139 | for (i = 0; i < nr_irqs; i++) { | ||
140 | struct irq_desc *desc = irq_to_desc(i); | ||
141 | unsigned int status; | ||
142 | |||
143 | if (!desc) | ||
144 | continue; | ||
145 | spin_lock_irq(&desc->lock); | 127 | spin_lock_irq(&desc->lock); |
146 | status = desc->status; | 128 | status = desc->status; |
147 | 129 | ||
@@ -180,13 +162,10 @@ EXPORT_SYMBOL(probe_irq_mask); | |||
180 | int probe_irq_off(unsigned long val) | 162 | int probe_irq_off(unsigned long val) |
181 | { | 163 | { |
182 | int i, irq_found = 0, nr_irqs = 0; | 164 | int i, irq_found = 0, nr_irqs = 0; |
165 | struct irq_desc *desc; | ||
166 | unsigned int status; | ||
183 | 167 | ||
184 | for (i = 0; i < nr_irqs; i++) { | 168 | for_each_irq_desc(i, desc) { |
185 | struct irq_desc *desc = irq_to_desc(i); | ||
186 | unsigned int status; | ||
187 | |||
188 | if (!desc) | ||
189 | continue; | ||
190 | spin_lock_irq(&desc->lock); | 169 | spin_lock_irq(&desc->lock); |
191 | status = desc->status; | 170 | status = desc->status; |
192 | 171 | ||
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index a69368ff607f..c815b42d0f5b 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -268,9 +268,10 @@ static struct lock_class_key irq_desc_lock_class; | |||
268 | 268 | ||
269 | void early_init_irq_lock_class(void) | 269 | void early_init_irq_lock_class(void) |
270 | { | 270 | { |
271 | struct irq_desc *desc; | ||
271 | int i; | 272 | int i; |
272 | 273 | ||
273 | for (i = 0; i < nr_irqs; i++) | 274 | for_each_irq_desc(i, desc) |
274 | lockdep_set_class(&irq_desc[i].lock, &irq_desc_lock_class); | 275 | lockdep_set_class(&desc->lock, &irq_desc_lock_class); |
275 | } | 276 | } |
276 | #endif | 277 | #endif |