summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2020-11-18 15:08:13 -0700
committerCommit Bot <commit-bot@chromium.org>2020-11-19 03:08:23 +0000
commitb46612ae811e921aa37b1f029bb86c1ef541a243 (patch)
treeef1d83c36abace1236232bafa7dc0912f888eac2
parent6e0750fda26606378b1c6e3c4ca0457fa93b5a5b (diff)
downloadchrome-ec-b46612ae811e921aa37b1f029bb86c1ef541a243.tar.gz
zephyr: gpio: declare interrupt handlers in gpio.c
To prevent a mess of includes inside of gpio_map.h (and to help cut back on people forgetting to include headers, since gpio_map.h is used quite universally), have gpio.c declare all the interrupt handlers before using them. BUG=b:169935802 BRANCH=none TEST=compile with powerseq CLs Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Iaead04b29ea68eb0b77f3a3b9c65938b629d2ab9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548300 Reviewed-by: Yuval Peress <peress@chromium.org>
-rw-r--r--zephyr/shim/src/gpio.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/zephyr/shim/src/gpio.c b/zephyr/shim/src/gpio.c
index ab10f08c5e..f3a73d5088 100644
--- a/zephyr/shim/src/gpio.c
+++ b/zephyr/shim/src/gpio.c
@@ -78,10 +78,18 @@ static void gpio_handler_shim(const struct device *port,
/*
* Each zephyr project should define EC_CROS_GPIO_INTERRUPTS in their gpio_map.h
- * file if there are any interrupts that should be registered.
+ * file if there are any interrupts that should be registered. The
+ * corresponding handler will be declared here, which will prevent
+ * needing to include headers with complex dependencies in gpio_map.h.
*
* EC_CROS_GPIO_INTERRUPTS is a space-separated list of GPIO_INT items.
*/
+#define GPIO_INT(sig, f, cb) void cb(enum gpio_signal signal);
+#ifdef EC_CROS_GPIO_INTERRUPTS
+EC_CROS_GPIO_INTERRUPTS
+#endif
+#undef GPIO_INT
+
#define GPIO_INT(sig, f, cb) \
{ \
.signal = sig, \
@@ -92,6 +100,7 @@ struct gpio_signal_callback gpio_interrupts[] = {
#ifdef EC_CROS_GPIO_INTERRUPTS
EC_CROS_GPIO_INTERRUPTS
#endif
+#undef GPIO_INT
};
/**