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