Re: [patch 1/2] genirq: allow usage of no_irq_chip

From: Thomas Gleixner
Date: Thu Jun 22 2006 - 15:52:08 EST


On Thu, 2006-06-22 at 10:51 +0200, Thomas Gleixner wrote:
> > Note that dropping it makes the genirq stuff buggy on ARM, so this
> > needs to be resolved before it can go anywhere near Linus' tree.
>
> I'm aware of that. I'm looking into the problem, which might be resolved
> by Bens outstanding patchset anyway.

No, it is not. The patch was actually one of the brown paperbag
category.

While Ben helped me to get my brain straight again, he mentioned that he
also could use an global extreme dumb irq_chip.

I came up with the following solution which allows us to keep the ARM
migration path smooth and might be of help for Ben too.

Also integrated into the latest armirq queue on top of 2.6.17:
http://www.tglx.de/projects/armirq/2.6.17/patch-2.6.17-armirq2.patches.tar.bz2

tglx


include/linux/irq.h | 3 ++-
kernel/irq/chip.c | 15 ++++++++++++---
kernel/irq/handle.c | 16 ++++++++++++++++
3 files changed, 30 insertions(+), 4 deletions(-)

Index: linux-2.6.17-mm/include/linux/irq.h
===================================================================
--- linux-2.6.17-mm.orig/include/linux/irq.h 2006-06-22 21:36:29.000000000 +0200
+++ linux-2.6.17-mm/include/linux/irq.h 2006-06-22 21:36:30.000000000 +0200
@@ -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,
Index: linux-2.6.17-mm/kernel/irq/handle.c
===================================================================
--- linux-2.6.17-mm.orig/kernel/irq/handle.c 2006-06-22 21:36:30.000000000 +0200
+++ linux-2.6.17-mm/kernel/irq/handle.c 2006-06-22 21:36:30.000000000 +0200
@@ -93,6 +93,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)
Index: linux-2.6.17-mm/kernel/irq/chip.c
===================================================================
--- linux-2.6.17-mm.orig/kernel/irq/chip.c 2006-06-22 21:36:29.000000000 +0200
+++ linux-2.6.17-mm/kernel/irq/chip.c 2006-06-22 21:36:30.000000000 +0200
@@ -459,9 +459,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);






-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/