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/drobit | |
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/drobit')
-rw-r--r-- | board/drobit/gpio.inc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/board/drobit/gpio.inc b/board/drobit/gpio.inc index bc7d625195..6bacab4474 100644 --- a/board/drobit/gpio.inc +++ b/board/drobit/gpio.inc @@ -180,5 +180,5 @@ 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 */ |