From 301fd861159c2e3682265aa5dce198bde697ed5e Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Mon, 14 Oct 2013 12:50:12 -0700 Subject: [PATCH] lm4: GPIO interrupt handler scans through fewer GPIOs Rather than scan the entire GPIO table, stop as soon as all interrupt bits have been handled. We hand-order the table so GPIOs with interrupts are first, so this should reduce interrupt overhead. BUG=chrome-os-partner:23296 BRANCH=none TEST=boot rambi x86indebug -1 apshutdown powerbtn ...That should print lots of 'x86 in' debug messages as pins change state, showing that the interrupt handlers are still responding. Change-Id: I7942cd51870ad51de068d90d68cf6634ff2fb1a0 Signed-off-by: Randall Spangler Reviewed-on: https://chromium-review.googlesource.com/173031 Reviewed-by: Alec Berg Reviewed-by: Vic Yang --- chip/lm4/gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chip/lm4/gpio.c b/chip/lm4/gpio.c index a6aeeaa58f..604cd91234 100644 --- a/chip/lm4/gpio.c +++ b/chip/lm4/gpio.c @@ -290,9 +290,11 @@ static void gpio_interrupt(int port, uint32_t mis) int i = 0; const struct gpio_info *g = gpio_list; - for (i = 0; i < GPIO_COUNT; i++, g++) { - if (port == g->port && (mis & g->mask) && g->irq_handler) + for (i = 0; i < GPIO_COUNT && mis; i++, g++) { + if (port == g->port && (mis & g->mask) && g->irq_handler) { g->irq_handler(i); + mis &= ~g->mask; + } } }