[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090723044321.GA2782@dtor-d630.eng.vmware.com>
Date: Wed, 22 Jul 2009 21:43:22 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: David Brownell <david-b@...bell.net>,
Peter Zijlstra <peterz@...radead.org>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Trilok Soni <soni.trilok@...il.com>,
Pavel Machek <pavel@....cz>, Arve Hj?nnev?g <arve@...roid.com>,
kernel list <linux-kernel@...r.kernel.org>,
Brian Swetland <swetland@...gle.com>,
linux-input@...r.kernel.org, Andrew Morton <akpm@...l.org>,
linux-i2c@...r.kernel.org,
Joonyoung Shim <jy0922.shim@...sung.com>,
m.szyprowski@...sung.com, t.fujak@...sung.com,
kyungmin.park@...sung.com, Daniel Ribeiro <drwyrm@...il.com>
Subject: Re: Threaded interrupts for synaptic touchscreen in HTC dream
On Wed, Jul 22, 2009 at 11:04:33PM +0200, Thomas Gleixner wrote:
>
> Any more ?
>
Can we also have something like below by any chance?
--
Dmitry
genirq: provide dummy hard irq handler for threaded interrupts
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
Quite often drivers using threaded interrupts don't do anything
in the hard IRQ portion of their interrupt handler; everything
is offloaded to the threaded half. Instead of having every driver
implement a stub have one ready in the IRQ core.
Signed-off-by: Dmitry Torokhov <dtor@...l.ru>
---
kernel/irq/manage.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 50da676..cdc52f6 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -695,6 +695,15 @@ out_thread:
return ret;
}
+/*
+ * Default hardirq handler for threaded irqs that is used when
+ * driver did not provide its own implementation.
+ */
+static irqreturn_t dummy_hardirq_handler(int irq, void *dev_id)
+{
+ return IRQ_WAKE_THREAD;
+}
+
/**
* setup_irq - setup an interrupt
* @irq: Interrupt line to setup
@@ -837,8 +846,11 @@ EXPORT_SYMBOL(free_irq);
* request_threaded_irq - allocate an interrupt line
* @irq: Interrupt line to allocate
* @handler: Function to be called when the IRQ occurs.
- * Primary handler for threaded interrupts
- * @thread_fn: Function called from the irq handler thread
+ * Primary handler for threaded interrupts.
+ * May be NULL, in which case a dummy interrupt
+ * handler is used that simply returns
+ * IRQ_WAKE_THREAD
+ * @thread_fn: Function called from the irq handler thread.
* If NULL, no irq thread is created
* @irqflags: Interrupt type flags
* @devname: An ascii name for the claiming device
@@ -917,14 +929,16 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
if (desc->status & IRQ_NOREQUEST)
return -EINVAL;
- if (!handler)
+
+ if (!handler && !thread_fn) {
return -EINVAL;
+ }
action = kzalloc(sizeof(struct irqaction), GFP_KERNEL);
if (!action)
return -ENOMEM;
- action->handler = handler;
+ action->handler = handler ?: dummy_hardirq_handler;
action->thread_fn = thread_fn;
action->flags = irqflags;
action->name = devname;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists