mfd: Fix off by one in WM831x IRQ code
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>
Tue, 21 Jun 2011 23:23:08 +0000 (00:23 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 31 Jul 2011 21:28:24 +0000 (23:28 +0200)
The GPIO IRQs aren't the first IRQs defined, we need to subtract the base
for the GPIOs as well to use them for array indexes.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/wm831x-irq.c

index 1808deb8083befa3556340a399bdcb4469db5587..6c3408ca2c2d1f14ddd86203dc664af6e0e40cc5 100644 (file)
@@ -408,6 +408,11 @@ static int wm831x_irq_set_type(struct irq_data *data, unsigned int type)
                        return -EINVAL;
        }
 
+       /* Rebase the IRQ into the GPIO range so we've got a sensible array
+        * index.
+        */
+       irq -= WM831X_IRQ_GPIO_1;
+
        /* We set the high bit to flag that we need an update; don't
         * do the update here as we can be called with the bus lock
         * held.