aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/irq_32.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-08-19 23:50:05 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:52:29 -0400
commit08678b0841267c1d00d771fe01548d86043d065e (patch)
tree7debb21f9e9a768ced43077f7376797a0c46f8c0 /arch/x86/kernel/irq_32.c
parentbfea1238beac9d306eeac081c67de5ca6aec4c7a (diff)
generic: sparse irqs: use irq_desc() together with dyn_array, instead of irq_desc[]
add CONFIG_HAVE_SPARSE_IRQ to for use condensed array. Get rid of irq_desc[] array assumptions. Preallocate 32 irq_desc, and irq_desc() will try to get more. ( No change in functionality is expected anywhere, except the odd build failure where we missed a code site or where a crossing commit itroduces new irq_desc[] usage. ) v2: according to Eric, change get_irq_desc() to irq_desc() Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/irq_32.c')
-rw-r--r--arch/x86/kernel/irq_32.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 4c7ffb32854c..ede513be517d 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -224,7 +224,7 @@ unsigned int do_IRQ(struct pt_regs *regs)
224 struct pt_regs *old_regs; 224 struct pt_regs *old_regs;
225 /* high bit used in ret_from_ code */ 225 /* high bit used in ret_from_ code */
226 int overflow, irq = ~regs->orig_ax; 226 int overflow, irq = ~regs->orig_ax;
227 struct irq_desc *desc = irq_desc + irq; 227 struct irq_desc *desc = irq_to_desc(irq);
228 228
229 if (unlikely((unsigned)irq >= nr_irqs)) { 229 if (unlikely((unsigned)irq >= nr_irqs)) {
230 printk(KERN_EMERG "%s: cannot handle IRQ %d\n", 230 printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
@@ -273,15 +273,16 @@ int show_interrupts(struct seq_file *p, void *v)
273 273
274 if (i < nr_irqs) { 274 if (i < nr_irqs) {
275 unsigned any_count = 0; 275 unsigned any_count = 0;
276 struct irq_desc *desc = irq_to_desc(i);
276 277
277 spin_lock_irqsave(&irq_desc[i].lock, flags); 278 spin_lock_irqsave(&desc->lock, flags);
278#ifndef CONFIG_SMP 279#ifndef CONFIG_SMP
279 any_count = kstat_irqs(i); 280 any_count = kstat_irqs(i);
280#else 281#else
281 for_each_online_cpu(j) 282 for_each_online_cpu(j)
282 any_count |= kstat_cpu(j).irqs[i]; 283 any_count |= kstat_cpu(j).irqs[i];
283#endif 284#endif
284 action = irq_desc[i].action; 285 action = desc->action;
285 if (!action && !any_count) 286 if (!action && !any_count)
286 goto skip; 287 goto skip;
287 seq_printf(p, "%3d: ",i); 288 seq_printf(p, "%3d: ",i);
@@ -291,8 +292,8 @@ int show_interrupts(struct seq_file *p, void *v)
291 for_each_online_cpu(j) 292 for_each_online_cpu(j)
292 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); 293 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
293#endif 294#endif
294 seq_printf(p, " %8s", irq_desc[i].chip->name); 295 seq_printf(p, " %8s", desc->chip->name);
295 seq_printf(p, "-%-8s", irq_desc[i].name); 296 seq_printf(p, "-%-8s", desc->name);
296 297
297 if (action) { 298 if (action) {
298 seq_printf(p, " %s", action->name); 299 seq_printf(p, " %s", action->name);
@@ -302,7 +303,7 @@ int show_interrupts(struct seq_file *p, void *v)
302 303
303 seq_putc(p, '\n'); 304 seq_putc(p, '\n');
304skip: 305skip:
305 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 306 spin_unlock_irqrestore(&desc->lock, flags);
306 } else if (i == nr_irqs) { 307 } else if (i == nr_irqs) {
307 seq_printf(p, "NMI: "); 308 seq_printf(p, "NMI: ");
308 for_each_online_cpu(j) 309 for_each_online_cpu(j)
@@ -398,17 +399,20 @@ void fixup_irqs(cpumask_t map)
398 399
399 for (irq = 0; irq < nr_irqs; irq++) { 400 for (irq = 0; irq < nr_irqs; irq++) {
400 cpumask_t mask; 401 cpumask_t mask;
402 struct irq_desc *desc;
403
401 if (irq == 2) 404 if (irq == 2)
402 continue; 405 continue;
403 406
404 cpus_and(mask, irq_desc[irq].affinity, map); 407 desc = irq_to_desc(irq);
408 cpus_and(mask, desc->affinity, map);
405 if (any_online_cpu(mask) == NR_CPUS) { 409 if (any_online_cpu(mask) == NR_CPUS) {
406 printk("Breaking affinity for irq %i\n", irq); 410 printk("Breaking affinity for irq %i\n", irq);
407 mask = map; 411 mask = map;
408 } 412 }
409 if (irq_desc[irq].chip->set_affinity) 413 if (desc->chip->set_affinity)
410 irq_desc[irq].chip->set_affinity(irq, mask); 414 desc->chip->set_affinity(irq, mask);
411 else if (irq_desc[irq].action && !(warned++)) 415 else if (desc->action && !(warned++))
412 printk("Cannot set affinity for irq %i\n", irq); 416 printk("Cannot set affinity for irq %i\n", irq);
413 } 417 }
414 418