summaryrefslogtreecommitdiff
path: root/board/copano
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2021-10-05 17:03:15 +0000
committerCommit Bot <commit-bot@chromium.org>2021-10-08 01:29:51 +0000
commit93830adaf8a499e58953c992208cff34106f05cb (patch)
treeb9ad08a129e535412c26c79db19627125697a9cf /board/copano
parent0b21ad072215053b2d1a872d800fe5ad9caadac7 (diff)
downloadchrome-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/copano')
-rw-r--r--board/copano/gpio.inc2
1 files changed, 1 insertions, 1 deletions
diff --git a/board/copano/gpio.inc b/board/copano/gpio.inc
index 3159821e94..52be1271f1 100644
--- a/board/copano/gpio.inc
+++ b/board/copano/gpio.inc
@@ -168,7 +168,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_GPIOD4, PIN(D, 4), GPIO_INPUT | GPIO_PULL_UP)