diff options
-rw-r--r-- | chip/npcx/gpio.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/chip/npcx/gpio.c b/chip/npcx/gpio.c index 57bd687c51..831c70e6de 100644 --- a/chip/npcx/gpio.c +++ b/chip/npcx/gpio.c @@ -790,14 +790,15 @@ static void gpio_interrupt(int int_no) if (!wui_mask) continue; - /* Clear pending bits of WUI */ - NPCX_WKPCL(i, j) = wui_mask; - for (pin = 0; pin < 8; pin++, gpio++) - /* If pending bit is high, execute ISR*/ - if (wui_mask & (1 << pin)) + /* If GPIO's pending bit is set, execute ISR */ + if ((wui_mask & (1 << pin)) && gpio->valid) { + /* Clear pending bit of GPIO */ + NPCX_WKPCL(i, j) = (1 << pin); + /* Execute GPIO's ISR */ gpio_execute_isr(gpio->port, 1 << gpio->bit); + } } } } |