diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2020-11-11 12:22:16 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-19 18:07:04 +0000 |
commit | 56b401d4133d6b273ebaf5e7649facf5ffbd5c37 (patch) | |
tree | a3dfe831052f4a27985b11b250e7f6f3bd0d3aa0 | |
parent | af0abef50af8858dfa9b1f2b5a2172b88bb3b83e (diff) | |
download | chrome-ec-56b401d4133d6b273ebaf5e7649facf5ffbd5c37.tar.gz |
zephyr: rename gpio_signal.h so that we have deterministic includes
Per go/zephyr-shim-how-to, the headers under zephyr/shim/include/ need
to be distinct names from those under include/, as the C compiler has
no defined ordering to searching the include paths. (i.e., there is
no such thing as a "header override").
Make include/gpio_shim.h include zephyr_gpio_shim.h instead, and
rename the zephyr header accordingly.
Without this, occasionally you can get this:
In file included from include/gpio_signal.h:26,
from include/espi.h:11,
from zephyr/shim/src/espi.c:14:
include/gpio.wrap:36:2: error: #error "Your architecture must ...
36 | #error "Your architecture must define GPIO_PIN and it did not."
| ^~~~~
include/gpio.wrap:40:2: error: #error "Your architecture must ...
40 | #error "Your architecture must define GPIO_PIN_MASK and it did not."
| ^~~~~
include/gpio.wrap:246:10: fatal error: gpio.inc: No such file or directory
246 | #include "gpio.inc"
| ^~~~~~~~~~
compilation terminated.
BUG=b:173031377
BRANCH=none
TEST=compile for volteer and posix-ec
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: I0eb23c41ee5c2be4f0405d3fadb71d6422d0ff40
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548303
Reviewed-by: Jett Rink <jettrink@chromium.org>
Commit-Queue: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | include/gpio_signal.h | 6 | ||||
-rw-r--r-- | zephyr/shim/include/zephyr_gpio_signal.h (renamed from zephyr/shim/include/gpio_signal.h) | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/include/gpio_signal.h b/include/gpio_signal.h index 478e83dca5..86fd5d7822 100644 --- a/include/gpio_signal.h +++ b/include/gpio_signal.h @@ -8,6 +8,10 @@ #include "compile_time_macros.h" +#ifdef CONFIG_ZEPHYR +#include "zephyr_gpio_signal.h" +#else + /* * There are 3 different IO signal types used by the EC. * Ensure they each use a unique range of values so we can tell them apart. @@ -46,4 +50,6 @@ BUILD_ASSERT(IOEX_SIGNAL_END < IOEX_LIMIT); #define IOEX_COUNT (IOEX_SIGNAL_END - IOEX_SIGNAL_START) +#endif /* !CONFIG_ZEPHYR */ + #endif /* __CROS_EC_GPIO_SIGNAL_H */ diff --git a/zephyr/shim/include/gpio_signal.h b/zephyr/shim/include/zephyr_gpio_signal.h index 72a6e3aa69..a6a55b59d9 100644 --- a/zephyr/shim/include/gpio_signal.h +++ b/zephyr/shim/include/zephyr_gpio_signal.h @@ -3,8 +3,10 @@ * found in the LICENSE file. */ -#ifndef __CROS_EC_GPIO_SIGNAL_H -#define __CROS_EC_GPIO_SIGNAL_H +#if !defined(__CROS_EC_GPIO_SIGNAL_H) || defined(__CROS_EC_ZEPHYR_GPIO_SIGNAL_H) +#error "This file must only be included from gpio_signal.h. Include gpio_signal.h directly." +#endif +#define __CROS_EC_ZEPHYR_GPIO_SIGNAL_H #include <devicetree.h> #include <toolchain.h> @@ -42,5 +44,3 @@ enum ioex_signal { BUILD_ASSERT(IOEX_SIGNAL_END < IOEX_LIMIT); #define IOEX_COUNT (IOEX_SIGNAL_END - IOEX_SIGNAL_START) - -#endif /* __CROS_EC_GPIO_SIGNAL_H */ |