m68k/mac: Optimize interrupts using chain handlers

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
index ff11746..425144c 100644
--- a/arch/m68k/mac/baboon.c
+++ b/arch/m68k/mac/baboon.c
@@ -56,6 +56,39 @@
  * Baboon interrupt handler. This works a lot like a VIA.
  */
 
+#ifdef CONFIG_GENERIC_HARDIRQS
+static void baboon_irq(unsigned int irq, struct irq_desc *desc)
+{
+	int irq_bit, irq_num;
+	unsigned char events;
+
+#ifdef DEBUG_IRQS
+	printk("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
+		(uint) baboon->mb_control, (uint) baboon->mb_ifr,
+		(uint) baboon->mb_status);
+#endif
+
+	events = baboon->mb_ifr & 0x07;
+	if (!events)
+		return;
+
+	irq_num = IRQ_BABOON_0;
+	irq_bit = 1;
+	do {
+	        if (events & irq_bit) {
+			baboon->mb_ifr &= ~irq_bit;
+			generic_handle_irq(irq_num);
+		}
+		irq_bit <<= 1;
+		irq_num++;
+	} while(events >= irq_bit);
+#if 0
+	if (baboon->mb_ifr & 0x02) macide_ack_intr(NULL);
+	/* for now we need to smash all interrupts */
+	baboon->mb_ifr &= ~events;
+#endif
+}
+#else
 static irqreturn_t baboon_irq(int irq, void *dev_id)
 {
 	int irq_bit, irq_num;
@@ -87,6 +120,7 @@
 #endif
 	return IRQ_HANDLED;
 }
+#endif
 
 /*
  * Register the Baboon interrupt dispatcher on nubus slot $C.
@@ -95,8 +129,12 @@
 void __init baboon_register_interrupts(void)
 {
 	baboon_disabled = 0;
+#ifdef CONFIG_GENERIC_HARDIRQS
+	irq_set_chained_handler(IRQ_NUBUS_C, baboon_irq);
+#else
 	if (request_irq(IRQ_NUBUS_C, baboon_irq, 0, "baboon", (void *)baboon))
 		pr_err("Couldn't register baboon interrupt\n");
+#endif
 }
 
 /*