[PATCH] setup_irq(): better mismatch debugging

When we get a mismatch between handlers on the same IRQ, all we get is "IRQ
handler type mismatch for IRQ n". Let's print the name of the
presently-registered handler with which we got the mismatch.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Andrew Morton and committed by Linus Torvalds 8b126b77 0579e303

+7 -2
+7 -2
kernel/irq/manage.c
··· 216 { 217 struct irq_desc *desc = irq_desc + irq; 218 struct irqaction *old, **p; 219 unsigned long flags; 220 int shared = 0; 221 ··· 256 * set the trigger type must match. 257 */ 258 if (!((old->flags & new->flags) & IRQF_SHARED) || 259 - ((old->flags ^ new->flags) & IRQF_TRIGGER_MASK)) 260 goto mismatch; 261 262 #if defined(CONFIG_IRQ_PER_CPU) 263 /* All handlers must agree on per-cpuness */ ··· 325 return 0; 326 327 mismatch: 328 - spin_unlock_irqrestore(&desc->lock, flags); 329 if (!(new->flags & IRQF_PROBE_SHARED)) { 330 printk(KERN_ERR "IRQ handler type mismatch for IRQ %d\n", irq); 331 dump_stack(); 332 } 333 return -EBUSY; 334 } 335
··· 216 { 217 struct irq_desc *desc = irq_desc + irq; 218 struct irqaction *old, **p; 219 + const char *old_name = NULL; 220 unsigned long flags; 221 int shared = 0; 222 ··· 255 * set the trigger type must match. 256 */ 257 if (!((old->flags & new->flags) & IRQF_SHARED) || 258 + ((old->flags ^ new->flags) & IRQF_TRIGGER_MASK)) { 259 + old_name = old->name; 260 goto mismatch; 261 + } 262 263 #if defined(CONFIG_IRQ_PER_CPU) 264 /* All handlers must agree on per-cpuness */ ··· 322 return 0; 323 324 mismatch: 325 if (!(new->flags & IRQF_PROBE_SHARED)) { 326 printk(KERN_ERR "IRQ handler type mismatch for IRQ %d\n", irq); 327 + if (old_name) 328 + printk(KERN_ERR "current handler: %s\n", old_name); 329 dump_stack(); 330 } 331 + spin_unlock_irqrestore(&desc->lock, flags); 332 return -EBUSY; 333 } 334