mfd: wm8994: Update to fully use irq_domain
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 13 May 2012 10:03:26 +0000 (11:03 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 15 May 2012 17:57:25 +0000 (18:57 +0100)
Take advantage of the new regmap irq_domain support to dynamically
allocate interrupts, using regmap_irq_get_virq() rather than irq_base
to look up the interrupts. This means that most users should not need
to specify an irq_base at all.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/wm8994-irq.c
include/linux/mfd/wm8994/core.h

index 46b20c445ecfdfa8e1d6f189344e8d037a503f2c..f1837f669755d4671615cb7a109e4d69ea827d21 100644 (file)
@@ -147,12 +147,6 @@ int wm8994_irq_init(struct wm8994 *wm8994)
                return 0;
        }
 
-       if (!wm8994->irq_base) {
-               dev_err(wm8994->dev,
-                       "No interrupt base specified, no interrupts\n");
-               return 0;
-       }
-
        ret = regmap_add_irq_chip(wm8994->regmap, wm8994->irq,
                                  IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
                                  wm8994->irq_base, &wm8994_irq_chip,
index 9eff2a351ec5cb77951e6bf64c902e14c78f40ce..6695c3ec4518ccfe73ebe1c307a24721d7fef943 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <linux/mutex.h>
 #include <linux/interrupt.h>
+#include <linux/regmap.h>
 
 enum wm8994_type {
        WM8994 = 0,
@@ -26,7 +27,6 @@ enum wm8994_type {
 
 struct regulator_dev;
 struct regulator_bulk_data;
-struct regmap;
 
 #define WM8994_NUM_GPIO_REGS 11
 #define WM8994_NUM_LDO_REGS   2
@@ -94,17 +94,17 @@ static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
                                     irq_handler_t handler, const char *name,
                                     void *data)
 {
-       if (!wm8994->irq_base)
+       if (!wm8994->irq_data)
                return -EINVAL;
-       return request_threaded_irq(wm8994->irq_base + irq, NULL, handler,
-                                   IRQF_TRIGGER_RISING, name,
+       return request_threaded_irq(regmap_irq_get_virq(wm8994->irq_data, irq),
+                                   NULL, handler, IRQF_TRIGGER_RISING, name,
                                    data);
 }
 static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data)
 {
-       if (!wm8994->irq_base)
+       if (!wm8994->irq_data)
                return;
-       free_irq(wm8994->irq_base + irq, data);
+       free_irq(regmap_irq_get_virq(wm8994->irq_data, irq), data);
 }
 
 int wm8994_irq_init(struct wm8994 *wm8994);