From 24beb9976a482c40cf5ad8302dcb2032dd5307d1 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Mon, 13 May 2013 14:07:21 -0700 Subject: [PATCH] do not store the keyboard state on the stack As our stack for the keyboard scanning task might be small (256 bytes on STM32), we store the full keyboard state in a global instead of the stack to avoid consuming 16 bytes there. Signed-off-by: Vincent Palatin BRANCH=none BUG=chrome-os-partner:19389 TEST=run on Spring with CONFIG_OVERFLOW_DETECT and see that the KEYSCAN task is now consuming 248 bytes of stack instead of 264. Change-Id: I2dd7815f36e6807e7b9e88d59f8fd8a14b1988ab Reviewed-on: https://gerrit.chromium.org/gerrit/51028 Reviewed-by: Vic Yang Reviewed-by: Randall Spangler Commit-Queue: Vincent Palatin Tested-by: Vincent Palatin --- common/keyboard_scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c index 4bc3c5deb0..95394272ed 100644 --- a/common/keyboard_scan.c +++ b/common/keyboard_scan.c @@ -274,7 +274,7 @@ static int check_keys_changed(uint8_t *state) int any_pressed = 0; int c, i; int any_change = 0; - uint8_t new_state[KEYBOARD_COLS]; + static uint8_t new_state[KEYBOARD_COLS]; uint32_t tnow = get_time().le.lo; /* Save the current scan time */