From: Dimitris Papastamos Date: Tue, 21 Jun 2011 23:23:08 +0000 (+0100) Subject: mfd: Fix off by one in WM831x IRQ code X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=08256712a2705f3ced3e54c3728932c9c39b58ad;p=sagit-ice-cold%2Fkernel_xiaomi_msm8998.git mfd: Fix off by one in WM831x IRQ code 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 Signed-off-by: Mark Brown Signed-off-by: Samuel Ortiz --- diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c index 1808deb8083b..6c3408ca2c2d 100644 --- a/drivers/mfd/wm831x-irq.c +++ b/drivers/mfd/wm831x-irq.c @@ -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.