summaryrefslogtreecommitdiff
path: root/test/flash.c
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2016-01-13 10:28:42 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-01-19 14:24:34 -0800
commit63eccdb090db507c055af4283171ab5371163580 (patch)
tree3a1ae3e25819af6e4ae06deb6c1c27cef3f01c4a /test/flash.c
parentcdaf11549f94f7b35c3bda986b5dbcca3e65e317 (diff)
downloadchrome-ec-63eccdb090db507c055af4283171ab5371163580.tar.gz
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 <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I4203c33cfa6d2b25d73d886b5248857a0c271565 Reviewed-on: https://chromium-review.googlesource.com/321913 Commit-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'test/flash.c')
-rw-r--r--test/flash.c11
1 files 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;