From e9883124ff1600db5788e44c332a403499fb5da6 Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Wed, 8 Apr 2015 16:42:55 -0700 Subject: gpio: Refactor IRQ handler pointer out of gpio_list In the gpio_info struct, we had a irq_handler pointer defined even though a majority of the GPIOs did not have irq handlers associated. By removing the irq_handler pointer out of the struct, we can save some space with some targets saving more than others. (For example, ~260 bytes for samus_pd). This change also brings about a new define: GPIO_INT(name, port, pin, flags, signal) And the existing GPIO macro has had the signal parameter removed since they were just NULL. GPIO(name, port, pin, flags) In each of the gpio.inc files, all the GPIOs with irq handlers must be defined at the top of the file. This is because their enum values from gpio_signal are used as the index to the gpio_irq_handlers table. BUG=chromium:471331 BRANCH=none TEST=Flashed ec to samus and samus_pd, verified lightbar tap, lid, power button, keyboard, charging, all still working. TEST=Moved a GPIO_INT declaration after a GPIO declaration and watched the build fail. TEST=make -j BOARD=peppy tests TEST=make -j BOARD=auron tests TEST=make -j BOARD=link tests Change-Id: Id6e261b0a3cd63223ca92f2e96a80c95e85cdefb Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/263973 Reviewed-by: Randall Spangler Tested-by: Aseda Aboagye Commit-Queue: Aseda Aboagye Trybot-Ready: Aseda Aboagye Reviewed-by: Alec Berg --- board/discovery/gpio.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'board/discovery') diff --git a/board/discovery/gpio.inc b/board/discovery/gpio.inc index 91e4d9587b..bce256bef8 100644 --- a/board/discovery/gpio.inc +++ b/board/discovery/gpio.inc @@ -6,11 +6,11 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO(USER_BUTTON, A, 0, GPIO_INT_BOTH, button_event) +GPIO_INT(USER_BUTTON, A, 0, GPIO_INT_BOTH, button_event) /* Outputs */ -GPIO(LED_BLUE, B, 6, GPIO_OUT_LOW, NULL) -GPIO(LED_GREEN, B, 7, GPIO_OUT_LOW, NULL) +GPIO(LED_BLUE, B, 6, GPIO_OUT_LOW) +GPIO(LED_GREEN, B, 7, GPIO_OUT_LOW) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) -- cgit v1.2.1