drivers: gpio_mcux: Fix interrupt handling

Change when we clear interrupt status to happen before we handle the
callbacks.  As the callbacks might manipluate the GPIO state and cause
a GPIO interrupt.  If we clear interrupt status after than we might
miss an interrupt.

Also only clear interrupts for interrupts that are we have enabled and
that were reported when we read from the interrupt status.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2019-09-23 17:47:31 -05:00 committed by Carles Cufí
commit 7989f5cd6b

View file

@ -348,10 +348,10 @@ static void gpio_mcux_port_isr(void *arg)
int_status = config->port_base->ISFR;
enabled_int = int_status & data->pin_callback_enables;
gpio_fire_callbacks(&data->callbacks, dev, enabled_int);
/* Clear the port interrupts */
config->port_base->ISFR = 0xFFFFFFFF;
config->port_base->ISFR = enabled_int;
gpio_fire_callbacks(&data->callbacks, dev, enabled_int);
}