diff options
author | Keith Short <keithshort@chromium.org> | 2021-09-17 14:34:27 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-17 22:33:35 +0000 |
commit | 351e3fe74dbbf8ddd9cd1b21f45de57f7da8a76a (patch) | |
tree | 527c274800ccd8c48779fcaaf58ba55446153dfb /zephyr/shim/src | |
parent | 738385237e86c55dfca6a1c5bc98e204d4fa8a0f (diff) | |
download | chrome-ec-351e3fe74dbbf8ddd9cd1b21f45de57f7da8a76a.tar.gz |
zephyr: minor reorganization of GPIO shim
Move a comment and a function to make the next CL cleaner.
BUG=none
BRANCH=none
TEST=none
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: I83185db995b083f839709eb564353a66364e87d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169562
Commit-Queue: Yuval Peress <peress@google.com>
Reviewed-by: Yuval Peress <peress@google.com>
Diffstat (limited to 'zephyr/shim/src')
-rw-r--r-- | zephyr/shim/src/gpio.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/zephyr/shim/src/gpio.c b/zephyr/shim/src/gpio.c index 5348133ead..01faf87fda 100644 --- a/zephyr/shim/src/gpio.c +++ b/zephyr/shim/src/gpio.c @@ -72,16 +72,14 @@ struct gpio_signal_callback { const gpio_flags_t flags; }; -/* The single zephyr gpio handler that routes to appropriate platform/ec cb */ -static void gpio_handler_shim(const struct device *port, - struct gpio_callback *cb, gpio_port_pins_t pins) -{ - const struct gpio_signal_callback *const gpio = - CONTAINER_OF(cb, struct gpio_signal_callback, callback); - - /* Call the platform/ec gpio interrupt handler */ - gpio->irq_handler(gpio->signal); -} +/* + * Each zephyr project should define EC_CROS_GPIO_INTERRUPTS in their gpio_map.h + * 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. + */ /* * Validate interrupt flags are valid for the Zephyr GPIO driver. @@ -106,14 +104,6 @@ EC_CROS_GPIO_INTERRUPTS #endif #undef GPIO_INT -/* - * Each zephyr project should define EC_CROS_GPIO_INTERRUPTS in their gpio_map.h - * 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 @@ -133,6 +123,17 @@ struct gpio_signal_callback gpio_interrupts[] = { #undef GPIO_INT }; +/* The single zephyr gpio handler that routes to appropriate platform/ec cb */ +static void gpio_handler_shim(const struct device *port, + struct gpio_callback *cb, gpio_port_pins_t pins) +{ + const struct gpio_signal_callback *const gpio = + CONTAINER_OF(cb, struct gpio_signal_callback, callback); + + /* Call the platform/ec gpio interrupt handler */ + gpio->irq_handler(gpio->signal); +} + /** * get_interrupt_from_signal() - Translate a gpio_signal to the * corresponding gpio_signal_callback |