Messages in this thread | | | Date | Wed, 21 Sep 2011 13:23:01 +0100 | From | Mark Brown <> | Subject | Re: mfd: Simulate active high IRQs with wm831x |
| |
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.
| |