浏览代码

Merge git://git.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-genirq

* git://git.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-genirq:
  genirq: do not leave interupts enabled on free_irq
  genirq: spurious.c: use time_* macros
Linus Torvalds 17 年之前
父节点
当前提交
cf91b824bb
共有 2 个文件被更改,包括 21 次插入2 次删除
  1. 19 1
      kernel/irq/chip.c
  2. 2 1
      kernel/irq/spurious.c

+ 19 - 1
kernel/irq/chip.c

@@ -245,6 +245,17 @@ static unsigned int default_startup(unsigned int irq)
 	return 0;
 	return 0;
 }
 }
 
 
+/*
+ * default shutdown function
+ */
+static void default_shutdown(unsigned int irq)
+{
+	struct irq_desc *desc = irq_desc + irq;
+
+	desc->chip->mask(irq);
+	desc->status |= IRQ_MASKED;
+}
+
 /*
 /*
  * Fixup enable/disable function pointers
  * Fixup enable/disable function pointers
  */
  */
@@ -256,8 +267,15 @@ void irq_chip_set_defaults(struct irq_chip *chip)
 		chip->disable = default_disable;
 		chip->disable = default_disable;
 	if (!chip->startup)
 	if (!chip->startup)
 		chip->startup = default_startup;
 		chip->startup = default_startup;
+	/*
+	 * We use chip->disable, when the user provided its own. When
+	 * we have default_disable set for chip->disable, then we need
+	 * to use default_shutdown, otherwise the irq line is not
+	 * disabled on free_irq():
+	 */
 	if (!chip->shutdown)
 	if (!chip->shutdown)
-		chip->shutdown = chip->disable;
+		chip->shutdown = chip->disable != default_disable ?
+			chip->disable : default_shutdown;
 	if (!chip->name)
 	if (!chip->name)
 		chip->name = chip->typename;
 		chip->name = chip->typename;
 	if (!chip->end)
 	if (!chip->end)

+ 2 - 1
kernel/irq/spurious.c

@@ -6,6 +6,7 @@
  * This file contains spurious interrupt handling.
  * This file contains spurious interrupt handling.
  */
  */
 
 
+#include <linux/jiffies.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/kallsyms.h>
 #include <linux/kallsyms.h>
@@ -179,7 +180,7 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc,
 		 * otherwise the couter becomes a doomsday timer for otherwise
 		 * otherwise the couter becomes a doomsday timer for otherwise
 		 * working systems
 		 * working systems
 		 */
 		 */
-		if (jiffies - desc->last_unhandled > HZ/10)
+		if (time_after(jiffies, desc->last_unhandled + HZ/10))
 			desc->irqs_unhandled = 1;
 			desc->irqs_unhandled = 1;
 		else
 		else
 			desc->irqs_unhandled++;
 			desc->irqs_unhandled++;