diff options
author | Caveh Jalali <caveh@chromium.org> | 2022-08-30 00:03:12 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-01 22:41:45 +0000 |
commit | 2e864b253903b8fbcfa509113be2407e76daea2e (patch) | |
tree | e383593749ba7d726dcdb45e30c2098a47bb4a05 /zephyr/shim | |
parent | 76789c78aff4a73c2dc0aca526267714fffb075b (diff) | |
download | chrome-ec-2e864b253903b8fbcfa509113be2407e76daea2e.tar.gz |
tree-wide: const-ify argv for console commands
This updates the API for console commands
from "int cmd(int argc, char **argv)"
to "int cmd(int argc, const char **argv)"
which is more accurate and in line with common convention.
BRANCH=none
BUG=b:244387210
TEST="make buildall" passes
TEST="zmake build -a" passes
TEST="util/compare_build.sh -b all" passes
TEST="./twister -v -T zephyr/test" passes
Cq-Depend: chrome-internal:4960125
Cq-Depend: chrome-internal:4959932
Change-Id: I57de9f35b85b8f3c7119df36aefb2abf25d2625f
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3863941
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/shim')
-rw-r--r-- | zephyr/shim/core/cortex-m/irq_command.c | 2 | ||||
-rw-r--r-- | zephyr/shim/include/zephyr_console_shim.h | 6 | ||||
-rw-r--r-- | zephyr/shim/src/console.c | 4 | ||||
-rw-r--r-- | zephyr/shim/src/i2c.c | 2 | ||||
-rw-r--r-- | zephyr/shim/src/rtc.c | 4 | ||||
-rw-r--r-- | zephyr/shim/src/system.c | 2 |
6 files changed, 10 insertions, 10 deletions
diff --git a/zephyr/shim/core/cortex-m/irq_command.c b/zephyr/shim/core/cortex-m/irq_command.c index 911aeae946..f88e8e9a5a 100644 --- a/zephyr/shim/core/cortex-m/irq_command.c +++ b/zephyr/shim/core/cortex-m/irq_command.c @@ -21,7 +21,7 @@ void sys_trace_isr_enter_user(int nested_interrupts) irq_count[irq]++; } -static int command_irq(int argc, char **argv) +static int command_irq(int argc, const char **argv) { ARG_UNUSED(argc); ARG_UNUSED(argv); diff --git a/zephyr/shim/include/zephyr_console_shim.h b/zephyr/shim/include/zephyr_console_shim.h index 87bee7498f..1a0d754439 100644 --- a/zephyr/shim/include/zephyr_console_shim.h +++ b/zephyr/shim/include/zephyr_console_shim.h @@ -10,7 +10,7 @@ struct zephyr_console_command { /* Handler for the command. argv[0] will be the command name. */ - int (*handler)(int argc, char **argv); + int (*handler)(int argc, const char **argv); #ifdef CONFIG_SHELL_HELP /* Description of args */ const char *argdesc; @@ -36,7 +36,7 @@ struct zephyr_console_command { * Return: the return value from the handler. */ int zshim_run_ec_console_command(const struct zephyr_console_command *command, - size_t argc, char **argv); + size_t argc, const char **argv); /* Internal wrappers for DECLARE_CONSOLE_COMMAND_* macros. */ #define _ZEPHYR_SHELL_COMMAND_SHIM_2(NAME, ROUTINE_ID, ARGDESC, HELP, \ @@ -45,7 +45,7 @@ int zshim_run_ec_console_command(const struct zephyr_console_command *command, .handler = ROUTINE_ID, _HELP_ARGS(ARGDESC, HELP) \ }; \ static int WRAPPER_ID(const struct shell *shell, size_t argc, \ - char **argv) \ + const char **argv) \ { \ return zshim_run_ec_console_command(&ENTRY_ID, argc, argv); \ } \ diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c index edd729efb7..1c5aa44e99 100644 --- a/zephyr/shim/src/console.c +++ b/zephyr/shim/src/console.c @@ -202,7 +202,7 @@ void uart_shell_start(void) } #ifdef CONFIG_SHELL_HELP -static void print_console_help(char *name, +static void print_console_help(const char *name, const struct zephyr_console_command *command) { if (command->help) @@ -213,7 +213,7 @@ static void print_console_help(char *name, #endif int zshim_run_ec_console_command(const struct zephyr_console_command *command, - size_t argc, char **argv) + size_t argc, const char **argv) { int ret; diff --git a/zephyr/shim/src/i2c.c b/zephyr/shim/src/i2c.c index 346665f0c2..8339f499f3 100644 --- a/zephyr/shim/src/i2c.c +++ b/zephyr/shim/src/i2c.c @@ -75,7 +75,7 @@ int i2c_get_port_from_remote_port(int remote_port) } #ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_I2C_PORTMAP -static int command_i2c_portmap(int argc, char **argv) +static int command_i2c_portmap(int argc, const char **argv) { int i; diff --git a/zephyr/shim/src/rtc.c b/zephyr/shim/src/rtc.c index 9627089f2e..f79c5b94e1 100644 --- a/zephyr/shim/src/rtc.c +++ b/zephyr/shim/src/rtc.c @@ -135,7 +135,7 @@ void print_system_rtc(enum console_channel ch) * chip-specific code. We should factor out the common parts. */ #ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_RTC -static int command_system_rtc(int argc, char **argv) +static int command_system_rtc(int argc, const char **argv) { if (argc == 3 && !strcasecmp(argv[1], "set")) { char *e; @@ -160,7 +160,7 @@ DECLARE_CONSOLE_COMMAND(rtc, command_system_rtc, "[set <seconds>]", /** * Test the RTC alarm by setting an interrupt on RTC match. */ -static int command_rtc_alarm_test(int argc, char **argv) +static int command_rtc_alarm_test(int argc, const char **argv) { int s = 1, us = 0; char *e; diff --git a/zephyr/shim/src/system.c b/zephyr/shim/src/system.c index f4a105ddd7..0d69a915df 100644 --- a/zephyr/shim/src/system.c +++ b/zephyr/shim/src/system.c @@ -160,7 +160,7 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds) /** * Print low power idle statistics */ -static int command_idle_stats(int argc, char **argv) +static int command_idle_stats(int argc, const char **argv) { const struct device *sys_dev = device_get_binding("CROS_SYSTEM"); |