[ARM] 3690/1: genirq: Introduce and make use of dummy irq chip

Patch from Thomas Gleixner

From: Thomas Gleixner <tglx@linutronix.de>

ARM has a couple of really dumb interrupt controllers.
Implement a generic one and fixup the ARM migration. ARM reused
the no_irq_chip for this purpose, but this does not work out
for platforms which are not converted to the new interrupt
type handling model.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 0832149..00b6ef8 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -348,8 +348,9 @@
 /* Checks whether the interrupt can be requested by request_irq(): */
 extern int can_request_irq(unsigned int irq, unsigned long irqflags);
 
-/* Dummy irq-chip implementation: */
+/* Dummy irq-chip implementations: */
 extern struct irq_chip no_irq_chip;
+extern struct irq_chip dummy_irq_chip;
 
 extern void
 set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 4a0952d..54105bd 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -462,9 +462,18 @@
 	if (!handle)
 		handle = handle_bad_irq;
 
-	if (is_chained && desc->chip == &no_irq_chip)
-		printk(KERN_WARNING "Trying to install "
-		       "chained interrupt type for IRQ%d\n", irq);
+	if (desc->chip == &no_irq_chip) {
+		printk(KERN_WARNING "Trying to install %sinterrupt handler "
+		       "for IRQ%d\n", is_chained ? "chained " : " ", irq);
+		/*
+		 * Some ARM implementations install a handler for really dumb
+		 * interrupt hardware without setting an irq_chip. This worked
+		 * with the ARM no_irq_chip but the check in setup_irq would
+		 * prevent us to setup the interrupt at all. Switch it to
+		 * dummy_irq_chip for easy transition.
+		 */
+		desc->chip = &dummy_irq_chip;
+	}
 
 	spin_lock_irqsave(&desc->lock, flags);
 
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 961b875..e71266c 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -96,6 +96,22 @@
 };
 
 /*
+ * Generic dummy implementation which can be used for
+ * real dumb interrupt sources
+ */
+struct irq_chip dummy_irq_chip = {
+	.name		= "dummy",
+	.startup	= noop_ret,
+	.shutdown	= noop,
+	.enable		= noop,
+	.disable	= noop,
+	.ack		= noop,
+	.mask		= noop,
+	.unmask		= noop,
+	.end		= noop,
+};
+
+/*
  * Special, empty irq handler:
  */
 irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs)