]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
genirq: add support for threaded interrupts to devres
authorArjan van de Ven <arjan@linux.intel.com>
Mon, 23 Mar 2009 17:28:16 +0000 (18:28 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 24 Mar 2009 11:15:23 +0000 (12:15 +0100)
Some devices use devres_request_irq() for to install their interrupt
handler. Add support for threaded interrupts to devres as well.

[tglx - simplified and adapted to latest threadirq version]

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/interrupt.h
kernel/irq/devres.c

index 6fc2b720c231200cbd69e1bf001f87caead8f907..dbf6a6fd116c1d0fec1d7b326a234a6c318936dc 100644 (file)
@@ -123,9 +123,20 @@ extern void free_irq(unsigned int, void *);
 
 struct device;
 
-extern int __must_check devm_request_irq(struct device *dev, unsigned int irq,
-                           irq_handler_t handler, unsigned long irqflags,
-                           const char *devname, void *dev_id);
+extern int __must_check
+devm_request_threaded_irq(struct device *dev, unsigned int irq,
+                         irq_handler_t handler, irq_handler_t thread_fn,
+                         unsigned long irqflags, const char *devname,
+                         void *dev_id);
+
+static inline int __must_check
+devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler,
+                unsigned long irqflags, const char *devname, void *dev_id)
+{
+       return devm_request_threaded_irq(dev, irq, handler, NULL, irqflags,
+                                        devname, dev_id);
+}
+
 extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
 
 /*
index 38a25b8d8bff6d15448270d4f56983537335fc2d..d06df9c41cba2cf4aee477737e341ad98d6c1493 100644 (file)
@@ -26,10 +26,12 @@ static int devm_irq_match(struct device *dev, void *res, void *data)
 }
 
 /**
- *     devm_request_irq - allocate an interrupt line for a managed device
+ *     devm_request_threaded_irq - allocate an interrupt line for a managed device
  *     @dev: device to request interrupt for
  *     @irq: Interrupt line to allocate
  *     @handler: Function to be called when the IRQ occurs
+ *     @thread_fn: function to be called in a threaded interrupt context. NULL
+ *                 for devices which handle everything in @handler
  *     @irqflags: Interrupt type flags
  *     @devname: An ascii name for the claiming device
  *     @dev_id: A cookie passed back to the handler function
@@ -42,9 +44,10 @@ static int devm_irq_match(struct device *dev, void *res, void *data)
  *     If an IRQ allocated with this function needs to be freed
  *     separately, dev_free_irq() must be used.
  */
-int devm_request_irq(struct device *dev, unsigned int irq,
-                    irq_handler_t handler, unsigned long irqflags,
-                    const char *devname, void *dev_id)
+int devm_request_threaded_irq(struct device *dev, unsigned int irq,
+                             irq_handler_t handler, irq_handler_t thread_fn,
+                             unsigned long irqflags, const char *devname,
+                             void *dev_id)
 {
        struct irq_devres *dr;
        int rc;
@@ -54,7 +57,8 @@ int devm_request_irq(struct device *dev, unsigned int irq,
        if (!dr)
                return -ENOMEM;
 
-       rc = request_irq(irq, handler, irqflags, devname, dev_id);
+       rc = request_threaded_irq(irq, handler, thread_fn, irqflags, devname,
+                                 dev_id);
        if (rc) {
                devres_free(dr);
                return rc;
@@ -66,7 +70,7 @@ int devm_request_irq(struct device *dev, unsigned int irq,
 
        return 0;
 }
-EXPORT_SYMBOL(devm_request_irq);
+EXPORT_SYMBOL(devm_request_threaded_irq);
 
 /**
  *     devm_free_irq - free an interrupt