From eb10d4518b0e37c483fbc0ec4915df47dee10f45 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Thu, 1 Sep 2016 17:57:05 -0700 Subject: Add check to prevent duplicate PIN assignments All PIN() assignments in board/$BOARD/gpio.inc must be unique, since otherwise you're just creating duplicate names and table entries for the same core interrupt and may not be initializing things the way you think. BUG=none BRANCH=none TEST=make buildall; test on Cr50 hardware Also verified that the image size is exactly the same before an after this CL. Change-Id: Ifb1805a010905f67fc5c0d246b6252af73715409 Signed-off-by: Bill Richardson Reviewed-on: https://chromium-review.googlesource.com/383773 Reviewed-by: Randall Spangler --- include/gpio_list.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/gpio_list.h') diff --git a/include/gpio_list.h b/include/gpio_list.h index 5fa9839e13..802a943b0b 100644 --- a/include/gpio_list.h +++ b/include/gpio_list.h @@ -37,3 +37,18 @@ const int gpio_ih_count = ARRAY_SIZE(gpio_irq_handlers); #define GPIO_INT(name, pin, flags, signal) \ BUILD_ASSERT(GPIO_##name < ARRAY_SIZE(gpio_irq_handlers)); #include "gpio.wrap" + +/* + * All PIN(...) assignments must be unique, since otherwise you're just + * creating duplicate names for the same thing, and may not always be + * initializing them the way you think. + */ +#define GPIO(name, pin, flags) pin +#define GPIO_INT(name, pin, flags, signal) pin +/* + * The compiler will complain if we use the same name twice. The linker ignores + * anything that gets by. + */ +#define PIN(a, b...) static const int _pin_ ## a ## _ ## b \ + __attribute__((unused, section(".unused"))) = __LINE__; +#include "gpio.wrap" -- cgit v1.2.1