kgdb: allow for cpu switch when single stepping
[safe/jmp/linux-2.6] / kernel / irq / devres.c
index 85a430d..d06df9c 100644 (file)
@@ -1,5 +1,7 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
+#include <linux/device.h>
+#include <linux/gfp.h>
 
 /*
  * Device resource management aware IRQ request/free implementation.
@@ -24,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
@@ -40,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;
@@ -52,9 +57,10 @@ 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) {
-               kfree(dr);
+               devres_free(dr);
                return rc;
        }
 
@@ -64,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