summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2016-03-22 11:17:05 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-03-22 16:21:33 -0700
commit6ea879339475c05475e31bc5d5263baf995e06a1 (patch)
tree862626fa9e8fd123597a84fa983e59bea93b7546
parentd36e177f9f9dae8d6038c3ba394bb30b821f99d7 (diff)
downloadchrome-ec-6ea879339475c05475e31bc5d5263baf995e06a1.tar.gz
cleanup: ectool: Ensure LED-related strings are defined for all types
Use asserts to ensure that new strings are added when new ec_led_colors / ec_led_id enum types are defined. BUG=None TEST=`make buildall -j` BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I4bcd6ad6de15b96a1c6a3fb70dbcc74f4d7f2857 Reviewed-on: https://chromium-review.googlesource.com/334382 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--util/ectool.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 0fbcafe050..d21bb99fe5 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -221,12 +221,14 @@ const char help_str[] =
static const char * const image_names[] = {"unknown", "RO", "RW"};
/* Note: depends on enum ec_led_colors */
-static const char * const led_color_names[EC_LED_COLOR_COUNT] = {
+static const char * const led_color_names[] = {
"red", "green", "blue", "yellow", "white", "amber"};
+BUILD_ASSERT(ARRAY_SIZE(led_color_names) == EC_LED_COLOR_COUNT);
/* Note: depends on enum ec_led_id */
-static const char * const led_names[EC_LED_ID_COUNT] = {
+static const char * const led_names[] = {
"battery", "power", "adapter"};
+BUILD_ASSERT(ARRAY_SIZE(led_names) == EC_LED_ID_COUNT);
/* Check SBS numerical value range */
int is_battery_range(int val)