Re: mfd: Simulate active high IRQs with wm831x

From: Mark Brown
Date: Wed Sep 21 2011 - 08:23:08 EST


On Wed, Sep 21, 2011 at 09:44:15AM +0300, Dan Carpenter wrote:

> 518 /* Simulate an edge triggered IRQ by polling the input
> 519 * status. This is sucky but improves interoperability.
> 520 */
> 521 if (primary == WM831X_GP_INT &&
> 522 wm831x->gpio_level[i - WM831X_IRQ_GPIO_1]) {
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> We're inside a for loop over ARRAY_SIZE(wm831x_irqs) which has 58
> elements (so "i" is 0-57) and we subtract WM831X_IRQ_GPIO_1 (1) which
> gives us a max of 56. The ->gpio_level[] array only has 16 elements

> In wm831x_irq_set_type() it only sets the first 11 elements of the
> ->gpio_level[] array. Perhaps something similar is needed here. I
> don't know the code well enough to say.

There's no need for any additional checks, the check for the primary IRQ
ensures that we know we're dealing with a GPIO IRQ.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/