summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2020-01-23 16:18:53 -0700
committerCommit Bot <commit-bot@chromium.org>2020-01-31 00:45:18 +0000
commitd682d368eeeaae56063859b2503c75fc4299022b (patch)
tree479b43eae2ba65e6102c27fd75288da712d4ad49
parente3181255263a8c5ef851bdb313d6b712a5dcd657 (diff)
downloadchrome-ec-d682d368eeeaae56063859b2503c75fc4299022b.tar.gz
ioexpander: Fix IOEX_INT after ioex_signal numbering change
Fix ioex_is_valid_interrupt_signal() and IOEX_INT() to account for IOEX_SIGNAL_START correctly. BUG=none BRANCH=none TEST=ioex_enable_interrupt() returns success Change-Id: I8f13fa8f2d645aae565ac1062eab4a4d0968c4bc Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2031649 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--common/ioexpander.c2
-rw-r--r--include/gpio_list.h5
2 files changed, 4 insertions, 3 deletions
diff --git a/common/ioexpander.c b/common/ioexpander.c
index e130e77a8a..de64bafc7e 100644
--- a/common/ioexpander.c
+++ b/common/ioexpander.c
@@ -51,7 +51,7 @@ static int ioex_is_valid_interrupt_signal(enum ioex_signal signal)
const struct ioex_info *g = ioex_get_signal_info(signal);
/* Fail if no interrupt handler */
- if (signal >= ioex_ih_count)
+ if (signal - IOEX_SIGNAL_START >= ioex_ih_count)
return EC_ERROR_PARAM1;
drv = ioex_config[g->ioex].drv;
diff --git a/include/gpio_list.h b/include/gpio_list.h
index 37d49a6f97..22025b25d8 100644
--- a/include/gpio_list.h
+++ b/include/gpio_list.h
@@ -111,8 +111,9 @@ const int ioex_ih_count = ARRAY_SIZE(ioex_irq_handlers);
* IOEX's declaration in the gpio.inc
* file.
*/
-#define IOEX_INT(name, expin, flags, handler) \
- BUILD_ASSERT(IOEX_##name < ARRAY_SIZE(ioex_irq_handlers));
+#define IOEX_INT(name, expin, flags, handler) \
+ BUILD_ASSERT(IOEX_##name - IOEX_SIGNAL_START \
+ < ARRAY_SIZE(ioex_irq_handlers));
#include "gpio.wrap"
#define IOEX(name, expin, flags) expin