Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / kernel / irq / spurious.c
blobf6297c306905536e14f0a70263e3da6a691c891e
1 /*
2 * linux/kernel/irq/spurious.c
4 * Copyright (C) 1992, 1998-2004 Linus Torvalds, Ingo Molnar
6 * This file contains spurious interrupt handling.
7 */
9 #include <linux/irq.h>
10 #include <linux/module.h>
11 #include <linux/kallsyms.h>
12 #include <linux/interrupt.h>
15 * If 99,900 of the previous 100,000 interrupts have not been handled
16 * then assume that the IRQ is stuck in some manner. Drop a diagnostic
17 * and try to turn the IRQ off.
19 * (The other 100-of-100,000 interrupts may have been a correctly
20 * functioning device sharing an IRQ with the failing one)
22 * Called under desc->lock
25 static void
26 __report_bad_irq(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret)
28 struct irqaction *action;
30 if (action_ret != IRQ_HANDLED && action_ret != IRQ_NONE) {
31 printk(KERN_ERR "irq event %d: bogus return value %x\n",
32 irq, action_ret);
33 } else {
34 printk(KERN_ERR "irq %d: nobody cared!\n", irq);
36 dump_stack();
37 printk(KERN_ERR "handlers:\n");
38 action = desc->action;
39 while (action) {
40 printk(KERN_ERR "[<%p>]", action->handler);
41 print_symbol(" (%s)",
42 (unsigned long)action->handler);
43 printk("\n");
44 action = action->next;
48 void report_bad_irq(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret)
50 static int count = 100;
52 if (count > 0) {
53 count--;
54 __report_bad_irq(irq, desc, action_ret);
58 void note_interrupt(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret)
60 if (action_ret != IRQ_HANDLED) {
61 desc->irqs_unhandled++;
62 if (action_ret != IRQ_NONE)
63 report_bad_irq(irq, desc, action_ret);
66 desc->irq_count++;
67 if (desc->irq_count < 100000)
68 return;
70 desc->irq_count = 0;
71 if (desc->irqs_unhandled > 99900) {
73 * The interrupt is stuck
75 __report_bad_irq(irq, desc, action_ret);
77 * Now kill the IRQ
79 printk(KERN_EMERG "Disabling IRQ #%d\n", irq);
80 desc->status |= IRQ_DISABLED;
81 desc->handler->disable(irq);
83 desc->irqs_unhandled = 0;
86 int noirqdebug;
88 int __init noirqdebug_setup(char *str)
90 noirqdebug = 1;
91 printk(KERN_INFO "IRQ lockup detection disabled\n");
92 return 1;
95 __setup("noirqdebug", noirqdebug_setup);