From 63eccdb090db507c055af4283171ab5371163580 Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Wed, 13 Jan 2016 10:28:42 -0800 Subject: [PATCH] test/flash: Use signal enum instead of string name Previously the flash test used the GPIO string name to identify the write protect GPIO. Change to use the GPIO signal enum. This is faster and removes a use of gpio_list. Signed-off-by: Anton Staaf BRANCH=None BUG=None TEST=make buildall -j Change-Id: I4203c33cfa6d2b25d73d886b5248857a0c271565 Reviewed-on: https://chromium-review.googlesource.com/321913 Commit-Ready: Anton Staaf Tested-by: Anton Staaf Reviewed-by: Randall Spangler --- test/flash.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/flash.c b/test/flash.c index 260d79d3d6..ab0cf29aa7 100644 --- a/test/flash.c +++ b/test/flash.c @@ -52,15 +52,16 @@ int flash_pre_op(void) int gpio_get_level(enum gpio_signal signal) { - const char *name = gpio_list[signal].name; - if (mock_wp == -1) mock_wp = !!(test_get_state() & BOOT_WP_MASK); - if (strcasecmp(name, "WP_L") == 0) - return !mock_wp; - if (strcasecmp(name, "WP") == 0) +#if defined(CONFIG_WP_ACTIVE_HIGH) + if (signal == GPIO_WP) return mock_wp; +#else + if (signal == GPIO_WP_L) + return !mock_wp; +#endif /* Signal other than write protect. Just return 0. */ return 0;