From 93830adaf8a499e58953c992208cff34106f05cb Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 5 Oct 2021 17:03:15 +0000 Subject: 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 Change-Id: I66a097b761c0b15466a30e53a710d532cd48256c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3206478 Reviewed-by: Eric Yilun Lin --- board/drobit/gpio.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'board/drobit') 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 */ -- cgit v1.2.1