diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2022-06-27 14:36:12 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-06-29 06:20:54 +0000 |
commit | a8091d2bf2aa5991a7fe2fafdf9cb2b8b56dfaba (patch) | |
tree | 7ac07b8ad2f1dc7b4f3ea976ae47bfd70f1c116c /common/gpio_commands.c | |
parent | faf897bf7b723b768b9ec1915fcdd24a9256036e (diff) | |
download | chrome-ec-a8091d2bf2aa5991a7fe2fafdf9cb2b8b56dfaba.tar.gz |
common/gpio_commands.c: Format with clang-format
BUG=b:236386294
BRANCH=none
TEST=none
Change-Id: I72076574b721b72560690e5aec3279300bebe697
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729652
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'common/gpio_commands.c')
-rw-r--r-- | common/gpio_commands.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/common/gpio_commands.c b/common/gpio_commands.c index 758a0ad8dc..eb80720f48 100644 --- a/common/gpio_commands.c +++ b/common/gpio_commands.c @@ -83,23 +83,18 @@ static enum ec_error_list set(const char *name, int value) /* Console commands */ struct gpio_flag_description { - const int bitfield; - const char* name; + const int bitfield; + const char *name; }; __maybe_unused static const struct gpio_flag_description gpio_descriptions[] = { - {GPIO_INPUT, "I"}, - {GPIO_OUTPUT, "O"}, - {GPIO_LOW, "L"}, - {GPIO_HIGH, "H"}, - {GPIO_OPEN_DRAIN, "ODR"}, - {GPIO_PULL_UP, "PU"}, - {GPIO_PULL_DOWN, "PD"}, - {GPIO_SEL_1P8V, "1P8"}, + { GPIO_INPUT, "I" }, { GPIO_OUTPUT, "O" }, + { GPIO_LOW, "L" }, { GPIO_HIGH, "H" }, + { GPIO_OPEN_DRAIN, "ODR" }, { GPIO_PULL_UP, "PU" }, + { GPIO_PULL_DOWN, "PD" }, { GPIO_SEL_1P8V, "1P8" }, #ifndef CONFIG_ZEPHYR - {GPIO_ANALOG, "A"}, - {GPIO_ALTERNATE, "ALT"}, - {GPIO_LOCKED, "LCK"} + { GPIO_ANALOG, "A" }, { GPIO_ALTERNATE, "ALT" }, + { GPIO_LOCKED, "LCK" } #endif }; @@ -108,12 +103,13 @@ static void print_gpio_info(int gpio) int changed, v, i; if (!gpio_is_implemented(gpio)) - return; /* Skip unsupported signals */ + return; /* Skip unsupported signals */ v = gpio_get_level(gpio); changed = last_val_changed(gpio, v); - /* Split the printf call into multiple calls to reduce the stack usage. */ + /* Split the printf call into multiple calls to reduce the stack usage. + */ ccprintf(" %d%c ", v, (changed ? '*' : ' ')); if (IS_ENABLED(CONFIG_CMD_GPIO_EXTENDED)) { @@ -148,15 +144,14 @@ static int command_gpio_get(int argc, char **argv) /* Otherwise print them all */ for (i = 0; i < GPIO_COUNT; i++) { if (!gpio_is_implemented(i)) - continue; /* Skip unsupported signals */ + continue; /* Skip unsupported signals */ print_gpio_info(i); } return EC_SUCCESS; } -DECLARE_SAFE_CONSOLE_COMMAND(gpioget, command_gpio_get, - "[name]", +DECLARE_SAFE_CONSOLE_COMMAND(gpioget, command_gpio_get, "[name]", "Read GPIO value(s)"); static int command_gpio_set(int argc, char **argv) @@ -222,9 +217,7 @@ DECLARE_CONSOLE_COMMAND_FLAGS(gpioset, command_gpio_set, #else "name <0 | 1>", #endif - "Set a GPIO", - CMD_FLAG_RESTRICTED -); + "Set a GPIO", CMD_FLAG_RESTRICTED); /*****************************************************************************/ /* Host commands */ @@ -267,7 +260,7 @@ static enum ec_status gpio_command_get(struct host_cmd_handler_args *args) i = p_v1->get_info.index; len = strlen(gpio_get_name(i)); - memcpy(r_v1->get_info.name, gpio_get_name(i), len+1); + memcpy(r_v1->get_info.name, gpio_get_name(i), len + 1); r_v1->get_info.val = gpio_get_level(i); r_v1->get_info.flags = gpio_get_default_flags(i); args->response_size = sizeof(r_v1->get_info); @@ -277,7 +270,6 @@ static enum ec_status gpio_command_get(struct host_cmd_handler_args *args) } return EC_RES_SUCCESS; - } DECLARE_HOST_COMMAND(EC_CMD_GPIO_GET, gpio_command_get, EC_VER_MASK(0) | EC_VER_MASK(1)); |