diff options
author | Tom Hughes <tomhughes@chromium.org> | 2021-10-05 17:03:15 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-08 01:29:51 +0000 |
commit | 93830adaf8a499e58953c992208cff34106f05cb (patch) | |
tree | b9ad08a129e535412c26c79db19627125697a9cf /board/lindar | |
parent | 0b21ad072215053b2d1a872d800fe5ad9caadac7 (diff) | |
download | chrome-ec-93830adaf8a499e58953c992208cff34106f05cb.tar.gz |
tree: Fix TEMP_SENSOR3 GPIO declaration
When building with clang, it reports:
board/chronicler/gpio.inc:178:1: error: initializer overrides prior
initialization of this subobject [-Werror,-Winitializer-overrides]
ALTERNATE(PIN(F, 1), 0, MODULE_ADC, 0) /* TEMP_SENSOR3 */
This expands to:
static const struct gpio_alt_func gpio_alt_funcs[] = {
...
{GPIO_PORT_F, (1U << (1)), .func = (0), .module_id = (MODULE_ADC), .flags =
(0)}
};
The problem is that struct gpio_alt_func has the order "module_id, func,
port, mask, flags", so in this case we are setting func to (1U << (1))
and then to (0).
It looks like the intent was to use the PIN_MASK macro instead of PIN,
which expands to:
static const struct gpio_alt_func gpio_alt_funcs[] = {
...
{.port = GPIO_PORT_F, .mask = ((1U << (1))), .func = (0), .module_id =
(MODULE_ADC), .flags = (0)},
};
The code appears to be repeated in several boards, which were found
with:
git grep --name-only TEMP_SENSOR3 | grep gpio.inc | sort | uniq
BRANCH=none
BUG=b:172020503
TEST=make CC=arm-none-eabi-clang BOARD=chronicler
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I66a097b761c0b15466a30e53a710d532cd48256c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3206478
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Diffstat (limited to 'board/lindar')
-rw-r--r-- | board/lindar/gpio.inc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/board/lindar/gpio.inc b/board/lindar/gpio.inc index 246b83cd3f..30dd2a3920 100644 --- a/board/lindar/gpio.inc +++ b/board/lindar/gpio.inc @@ -169,7 +169,7 @@ ALTERNATE(PIN_MASK(0, BIT(0) | BIT(1) | BIT(2)), 0, MODULE_PMU, 0) /* GPIO00 = /* Temperature sensors */ ALTERNATE(PIN_MASK(4, BIT(2) | BIT(4) | BIT(5)), 0, MODULE_ADC, 0) /* TEMP_SENSOR1,2,4 */ -ALTERNATE(PIN(F, 1), 0, MODULE_ADC, 0) /* TEMP_SENSOR3 */ +ALTERNATE(PIN_MASK(F, BIT(1)), 0, MODULE_ADC, 0) /* TEMP_SENSOR3 */ /* Unused signals */ GPIO(UNUSED_GPIO60, PIN(6, 0), GPIO_INPUT | GPIO_PULL_UP) |