Re: Threaded interrupts for synaptic touchscreen in HTC dream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

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@xxxxxxx>
---

 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-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux