]> bbs.cooldavid.org Git - net-next-2.6.git/commit
genirq: Introduce request_any_context_irq()
authorMarc Zyngier <maz@misterjones.org>
Mon, 15 Mar 2010 22:56:33 +0000 (22:56 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 13 Apr 2010 14:36:39 +0000 (16:36 +0200)
commitae731f8d0785ccd3380f511bae888933b6562e45
tree07db03ce79231153a4ae5df75c0ca4dcd96307c2
parent7c7145f6acc68100dbdc5d3c5c64fe3af1c99c89
genirq: Introduce request_any_context_irq()

Now that we enjoy threaded interrupts, we're starting to see irq_chip
implementations (wm831x, pca953x) that make use of threaded interrupts
for the controller, and nested interrupts for the client interrupt. It
all works very well, with one drawback:

Drivers requesting an IRQ must now know whether the handler will
run in a thread context or not, and call request_threaded_irq() or
request_irq() accordingly.

The problem is that the requesting driver sometimes doesn't know
about the nature of the interrupt, specially when the interrupt
controller is a discrete chip (typically a GPIO expander connected
over I2C) that can be connected to a wide variety of otherwise perfectly
supported hardware.

This patch introduces the request_any_context_irq() function that mostly
mimics the usual request_irq(), except that it checks whether the irq
level is configured as nested or not, and calls the right backend.
On success, it also returns either IRQC_IS_HARDIRQ or IRQC_IS_NESTED.

[ tglx: Made return value an enum, simplified code and made the export
   of request_any_context_irq GPL ]

Signed-off-by: Marc Zyngier <maz@misterjones.org>
Cc: <joachim.eastwood@jotron.com>
LKML-Reference: <927ea285bd0c68934ddae1a47e44a9ba@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/interrupt.h
kernel/irq/manage.c