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 /driver | |
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 'driver')
33 files changed, 51 insertions, 51 deletions
diff --git a/driver/amd_stt.c b/driver/amd_stt.c index a93992784c..50ebb9fb9d 100644 --- a/driver/amd_stt.c +++ b/driver/amd_stt.c @@ -110,7 +110,7 @@ static void amd_stt_handler(void) } DECLARE_HOOK(HOOK_SECOND, amd_stt_handler, HOOK_PRIO_TEMP_SENSOR + 1); -static int command_stt(int argc, char **argv) +static int command_stt(int argc, const char **argv) { int sensor_id; int temp; diff --git a/driver/battery/bq27541.c b/driver/battery/bq27541.c index b063d220bf..a7af8071eb 100644 --- a/driver/battery/bq27541.c +++ b/driver/battery/bq27541.c @@ -389,7 +389,7 @@ enum battery_disconnect_state battery_get_disconnect_state(void) } #endif /* CONFIG_BATTERY_REVIVE_DISCONNECT */ -static int command_battfake(int argc, char **argv) +static int command_battfake(int argc, const char **argv) { char *e; int v; diff --git a/driver/battery/bq27621_g1.c b/driver/battery/bq27621_g1.c index cd11b2f269..1995d93eb5 100644 --- a/driver/battery/bq27621_g1.c +++ b/driver/battery/bq27621_g1.c @@ -567,7 +567,7 @@ int battery_wait_for_stable(void) #ifdef CONFIG_CMD_BATDEBUG -static int command_fgunseal(int argc, char **argv) +static int command_fgunseal(int argc, const char **argv) { int rv = EC_SUCCESS; @@ -581,7 +581,7 @@ static int command_fgunseal(int argc, char **argv) DECLARE_CONSOLE_COMMAND(fgunseal, command_fgunseal, "", "Unseal the fg"); -static int command_fgseal(int argc, char **argv) +static int command_fgseal(int argc, const char **argv) { int rv = EC_SUCCESS; @@ -595,7 +595,7 @@ static int command_fgseal(int argc, char **argv) DECLARE_CONSOLE_COMMAND(fgseal, command_fgseal, "", "Seal the fg"); -static int command_fginit(int argc, char **argv) +static int command_fginit(int argc, const char **argv) { int rv = EC_SUCCESS; int force = 0; @@ -628,7 +628,7 @@ static int command_fginit(int argc, char **argv) DECLARE_CONSOLE_COMMAND(fginit, command_fginit, "[force]", "Initialize the fg"); -static int command_fgprobe(int argc, char **argv) +static int command_fgprobe(int argc, const char **argv) { int rv = EC_SUCCESS; @@ -642,7 +642,7 @@ static int command_fgprobe(int argc, char **argv) DECLARE_CONSOLE_COMMAND(fgprobe, command_fgprobe, "", "Probe the fg"); -static int command_fgrd(int argc, char **argv) +static int command_fgrd(int argc, const char **argv) { int cmd, len; int rv = EC_SUCCESS; @@ -675,7 +675,7 @@ static int command_fgrd(int argc, char **argv) DECLARE_CONSOLE_COMMAND(fgrd, command_fgrd, "cmd len", "Read _len_ words from the fg"); -static int command_fgcmd(int argc, char **argv) +static int command_fgcmd(int argc, const char **argv) { int cmd, data, byte = 0; char *e; @@ -709,7 +709,7 @@ static int command_fgcmd(int argc, char **argv) DECLARE_CONSOLE_COMMAND(fgcmd, command_fgcmd, "cmd data [byte]", "Send a cmd to the fg"); -static int command_fgcmdrd(int argc, char **argv) +static int command_fgcmdrd(int argc, const char **argv) { int cmd, data, val; int rv = EC_SUCCESS; diff --git a/driver/battery/smart.c b/driver/battery/smart.c index 5d56f2602a..8d3db27f0f 100644 --- a/driver/battery/smart.c +++ b/driver/battery/smart.c @@ -526,7 +526,7 @@ int battery_wait_for_stable(void) } #if defined(CONFIG_CMD_BATTFAKE) -static int command_battfake(int argc, char **argv) +static int command_battfake(int argc, const char **argv) { char *e; int v; @@ -548,7 +548,7 @@ DECLARE_CONSOLE_COMMAND(battfake, command_battfake, "percent (-1 = use real level)", "Set fake battery level"); -static int command_batttempfake(int argc, char **argv) +static int command_batttempfake(int argc, const char **argv) { char *e; int t; @@ -574,7 +574,7 @@ DECLARE_CONSOLE_COMMAND( #endif #ifdef CONFIG_CMD_BATT_MFG_ACCESS -static int command_batt_mfg_access_read(int argc, char **argv) +static int command_batt_mfg_access_read(int argc, const char **argv) { char *e; uint8_t data[32]; diff --git a/driver/charger/bd9995x.c b/driver/charger/bd9995x.c index 896da5a523..a50f73e206 100644 --- a/driver/charger/bd9995x.c +++ b/driver/charger/bd9995x.c @@ -1492,7 +1492,7 @@ static void console_bd9995x_dump_regs(int chgnum) #endif /* CONFIG_CMD_CHARGER_DUMP */ #ifdef CONFIG_CMD_CHARGER -static int console_command_bd9995x(int argc, char **argv) +static int console_command_bd9995x(int argc, const char **argv) { int rv, reg, data, val; char rw, *e; @@ -1590,7 +1590,7 @@ static int bd9995x_enable_psys(int chgnum) * update "psys" console command to use charger_get_system_power and move it * to some common code. */ -static int console_command_psys(int argc, char **argv) +static int console_command_psys(int argc, const char **argv) { int rv; @@ -1677,7 +1677,7 @@ static int bd9995x_amon_bmon(int chgnum, int amon_bmon) /** * Get charger AMON and BMON current. */ -static int console_command_amon_bmon(int argc, char **argv) +static int console_command_amon_bmon(int argc, const char **argv) { int rv = EC_ERROR_PARAM1; diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c index e3a67ab2b6..ff3a13a37a 100644 --- a/driver/charger/isl923x.c +++ b/driver/charger/isl923x.c @@ -1107,7 +1107,7 @@ int charger_get_system_power(void) return adc; } -static int console_command_psys(int argc, char **argv) +static int console_command_psys(int argc, const char **argv) { ccprintf("PSYS = %d uW\n", charger_get_system_power()); return 0; @@ -1137,7 +1137,7 @@ static int print_amon_bmon(int chgnum, enum isl923x_amon_bmon amon, /** * Get charger AMON and BMON current. */ -static int console_command_amon_bmon(int argc, char **argv) +static int console_command_amon_bmon(int argc, const char **argv) { int ret = EC_SUCCESS; int print_ac = 1; diff --git a/driver/charger/sy21612.c b/driver/charger/sy21612.c index 6089de1ee7..427bc595e8 100644 --- a/driver/charger/sy21612.c +++ b/driver/charger/sy21612.c @@ -184,7 +184,7 @@ void sy21612_task(void *u) #endif #ifdef CONFIG_CMD_CHARGER -static int command_sy21612(int argc, char **argv) +static int command_sy21612(int argc, const char **argv) { int i, val, rv; diff --git a/driver/gl3590.c b/driver/gl3590.c index 201228c368..27650c6204 100644 --- a/driver/gl3590.c +++ b/driver/gl3590.c @@ -306,7 +306,7 @@ int gl3590_enable_ports(int hub, uint8_t port_mask, bool enable) } #ifdef CONFIG_CMD_GL3590 -static int command_gl3590(int argc, char **argv) +static int command_gl3590(int argc, const char **argv) { char *e; int port; diff --git a/driver/ina2xx.c b/driver/ina2xx.c index 6a785d1122..3691e62503 100644 --- a/driver/ina2xx.c +++ b/driver/ina2xx.c @@ -122,7 +122,7 @@ static void ina2xx_dump(uint8_t idx) /*****************************************************************************/ /* Console commands */ -static int command_ina(int argc, char **argv) +static int command_ina(int argc, const char **argv) { char *e; int idx; diff --git a/driver/ina3221.c b/driver/ina3221.c index 3220cebd23..67f0c5710a 100644 --- a/driver/ina3221.c +++ b/driver/ina3221.c @@ -121,7 +121,7 @@ static void ina3221_dump(unsigned int unit) /*****************************************************************************/ /* Console commands */ -static int command_ina(int argc, char **argv) +static int command_ina(int argc, const char **argv) { char *e; unsigned int unit; diff --git a/driver/ioexpander/it8801.c b/driver/ioexpander/it8801.c index 382f6dc547..eddd20b56d 100644 --- a/driver/ioexpander/it8801.c +++ b/driver/ioexpander/it8801.c @@ -561,7 +561,7 @@ static void dump_register(int reg) ccprintf("ERR (%d)\n", rv); } -static int it8801_dump(int argc, char **argv) +static int it8801_dump(int argc, const char **argv) { dump_register(IT8801_REG_KSIIER); dump_register(IT8801_REG_KSIEER); diff --git a/driver/led/ds2413.c b/driver/led/ds2413.c index 1529d84772..202fddb1ce 100644 --- a/driver/led/ds2413.c +++ b/driver/led/ds2413.c @@ -149,7 +149,7 @@ DECLARE_HOOK(HOOK_SECOND, onewire_led_tick, HOOK_PRIO_DEFAULT); /*****************************************************************************/ /* Console commands */ #define CONFIG_CMD_POWERLED -static int command_powerled(int argc, char **argv) +static int command_powerled(int argc, const char **argv) { int i; diff --git a/driver/led/lp5562.c b/driver/led/lp5562.c index e0758a8b91..8e8716213c 100644 --- a/driver/led/lp5562.c +++ b/driver/led/lp5562.c @@ -123,7 +123,7 @@ int lp5562_set_pc(int engine, int val) /*****************************************************************************/ /* Console commands */ #ifdef CONFIG_CMD_POWERLED -static int command_lp5562(int argc, char **argv) +static int command_lp5562(int argc, const char **argv) { if (argc == 4) { char *e; diff --git a/driver/mcdp28x0.c b/driver/mcdp28x0.c index 4502d00eca..4fd8289398 100644 --- a/driver/mcdp28x0.c +++ b/driver/mcdp28x0.c @@ -255,7 +255,7 @@ static int mcdp_appstest(uint8_t cmd, int paramc, char **paramv) return EC_SUCCESS; } -int command_mcdp(int argc, char **argv) +int command_mcdp(int argc, const char **argv) { int rv = EC_SUCCESS; char *e; diff --git a/driver/mp4245.c b/driver/mp4245.c index 097053de42..216fac120d 100644 --- a/driver/mp4245.c +++ b/driver/mp4245.c @@ -163,7 +163,7 @@ void mp4245_get_status(void) ccprintf("\tIlim = %d mA, Ibus = %d mA\n", ilim, ibus); } -static int command_mp4245(int argc, char **argv) +static int command_mp4245(int argc, const char **argv) { char *e; int val; diff --git a/driver/nfc/ctn730.c b/driver/nfc/ctn730.c index ea7eeb29df..5beaf5f489 100644 --- a/driver/nfc/ctn730.c +++ b/driver/nfc/ctn730.c @@ -663,7 +663,7 @@ const struct pchg_drv ctn730_drv = { .update_close = ctn730_update_close, }; -static int cc_ctn730(int argc, char **argv) +static int cc_ctn730(int argc, const char **argv) { int port; char *end; diff --git a/driver/regulator_ir357x.c b/driver/regulator_ir357x.c index 3120bbc0ab..94c42d37f9 100644 --- a/driver/regulator_ir357x.c +++ b/driver/regulator_ir357x.c @@ -195,7 +195,7 @@ static int ir357x_check(void) } #ifdef CONFIG_CMD_REGULATOR -static int command_ir357x(int argc, char **argv) +static int command_ir357x(int argc, const char **argv) { int reg, val; char *rem; diff --git a/driver/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c index 10607a4a58..4123e76c23 100644 --- a/driver/retimer/bb_retimer.c +++ b/driver/retimer/bb_retimer.c @@ -624,7 +624,7 @@ const struct usb_mux_driver bb_usb_retimer = { }; #ifdef CONFIG_CMD_RETIMER -static int console_command_bb_retimer(int argc, char **argv) +static int console_command_bb_retimer(int argc, const char **argv) { char rw, *e; int port, reg, data, val = 0; diff --git a/driver/retimer/kb800x.c b/driver/retimer/kb800x.c index 18eda4f66a..0581b813c9 100644 --- a/driver/retimer/kb800x.c +++ b/driver/retimer/kb800x.c @@ -474,7 +474,7 @@ static int kb800x_enter_low_power_mode(const struct usb_mux *me) #ifdef CONFIG_CMD_RETIMER -static int console_command_kb800x_xfer(int argc, char **argv) +static int console_command_kb800x_xfer(int argc, const char **argv) { char rw, *e; int rv, port, reg, val; diff --git a/driver/sync.c b/driver/sync.c index bedacbe5fc..1fdb8d2589 100644 --- a/driver/sync.c +++ b/driver/sync.c @@ -106,7 +106,7 @@ static int sync_init(struct motion_sensor_t *s) } #ifdef CONFIG_SYNC_COMMAND -static int command_sync(int argc, char **argv) +static int command_sync(int argc, const char **argv) { int count = 1, i; diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c index 0aa732d0b8..954e2a82d7 100644 --- a/driver/tcpm/anx7447.c +++ b/driver/tcpm/anx7447.c @@ -250,7 +250,7 @@ int anx7447_flash_erase(int port) } /* Add console command to erase OCM flash if needed. */ -static int command_anx_ocm(int argc, char **argv) +static int command_anx_ocm(int argc, const char **argv) { char *e = NULL; int port; diff --git a/driver/tcpm/rt1718s.c b/driver/tcpm/rt1718s.c index 319d1b14af..ff6b70075b 100644 --- a/driver/tcpm/rt1718s.c +++ b/driver/tcpm/rt1718s.c @@ -728,7 +728,7 @@ int rt1718s_gpio_get_level(int port, enum rt1718s_gpio signal) return !!(val & RT1718S_GPIO_CTRL_I); } -static int command_rt1718s_gpio(int argc, char **argv) +static int command_rt1718s_gpio(int argc, const char **argv) { int i, j; uint32_t flags; diff --git a/driver/temp_sensor/adt7481.c b/driver/temp_sensor/adt7481.c index c26247f80c..4f4e2ff358 100644 --- a/driver/temp_sensor/adt7481.c +++ b/driver/temp_sensor/adt7481.c @@ -254,7 +254,7 @@ static int print_status(void) return EC_SUCCESS; } -static int command_adt7481(int argc, char **argv) +static int command_adt7481(int argc, const char **argv) { char *command; char *e; diff --git a/driver/temp_sensor/f75303.c b/driver/temp_sensor/f75303.c index 0a944f2d8d..51c56686a4 100644 --- a/driver/temp_sensor/f75303.c +++ b/driver/temp_sensor/f75303.c @@ -58,7 +58,7 @@ static void f75303_sensor_poll(void) } DECLARE_HOOK(HOOK_SECOND, f75303_sensor_poll, HOOK_PRIO_TEMP_SENSOR); -static int f75303_set_fake_temp(int argc, char **argv) +static int f75303_set_fake_temp(int argc, const char **argv) { int index; int value; diff --git a/driver/temp_sensor/g753.c b/driver/temp_sensor/g753.c index 5dbc47064a..65968cd021 100644 --- a/driver/temp_sensor/g753.c +++ b/driver/temp_sensor/g753.c @@ -128,9 +128,9 @@ static int print_status(void) return EC_SUCCESS; } -static int command_g753(int argc, char **argv) +static int command_g753(int argc, const char **argv) { - char *command; + const char *command; char *e; int data; int offset; diff --git a/driver/temp_sensor/g78x.c b/driver/temp_sensor/g78x.c index 22af57c2d8..7530c56c16 100644 --- a/driver/temp_sensor/g78x.c +++ b/driver/temp_sensor/g78x.c @@ -171,7 +171,7 @@ static int print_status(void) return EC_SUCCESS; } -static int command_g78x(int argc, char **argv) +static int command_g78x(int argc, const char **argv) { char *command; char *e; diff --git a/driver/temp_sensor/tmp006.c b/driver/temp_sensor/tmp006.c index 265d9d804e..334979e826 100644 --- a/driver/temp_sensor/tmp006.c +++ b/driver/temp_sensor/tmp006.c @@ -402,7 +402,7 @@ static int tmp006_print(int idx) return EC_SUCCESS; } -static int command_sensor_info(int argc, char **argv) +static int command_sensor_info(int argc, const char **argv) { int i; int rv, rv1; @@ -433,7 +433,7 @@ DECLARE_CONSOLE_COMMAND(tmp006, command_sensor_info, "[ <index> ]", /* Disable the t6cal command until/unless we have FP support in printf */ #if 0 -static int command_t6cal(int argc, char **argv) +static int command_t6cal(int argc, const char **argv) { struct tmp006_data_t *tdata; char *e; diff --git a/driver/temp_sensor/tmp411.c b/driver/temp_sensor/tmp411.c index 804fa30644..6fcc65c5b4 100644 --- a/driver/temp_sensor/tmp411.c +++ b/driver/temp_sensor/tmp411.c @@ -233,7 +233,7 @@ static int print_status(void) return EC_SUCCESS; } -static int command_tmp411(int argc, char **argv) +static int command_tmp411(int argc, const char **argv) { char *command; char *e; diff --git a/driver/temp_sensor/tmp432.c b/driver/temp_sensor/tmp432.c index 54414a2f3e..6afb81b6c6 100644 --- a/driver/temp_sensor/tmp432.c +++ b/driver/temp_sensor/tmp432.c @@ -297,11 +297,11 @@ static int print_status(void) return EC_SUCCESS; } -static int command_tmp432(int argc, char **argv) +static int command_tmp432(int argc, const char **argv) { - char *command; + const char *command; char *e; - char *power; + const char *power; int data; int offset; int rv; diff --git a/driver/touchpad_gt7288.c b/driver/touchpad_gt7288.c index deb4665e09..1dcfdbfb61 100644 --- a/driver/touchpad_gt7288.c +++ b/driver/touchpad_gt7288.c @@ -125,7 +125,7 @@ int gt7288_read_ptp_report(struct gt7288_ptp_report *report) } #ifdef CONFIG_CMD_GT7288 -static int command_gt7288_read_desc(int argc, char **argv) +static int command_gt7288_read_desc(int argc, const char **argv) { uint16_t register_id; long parsed_arg; @@ -152,7 +152,7 @@ static int command_gt7288_read_desc(int argc, char **argv) DECLARE_CONSOLE_COMMAND(gt7288_desc, command_gt7288_read_desc, "register", "Read a descriptor on the GT7288"); -static int command_gt7288_read_report_descriptor(int argc, char **argv) +static int command_gt7288_read_report_descriptor(int argc, const char **argv) { int i; uint8_t data[64]; @@ -183,7 +183,7 @@ static int command_gt7288_read_report_descriptor(int argc, char **argv) DECLARE_CONSOLE_COMMAND(gt7288_repdesc, command_gt7288_read_report_descriptor, "", "Read the report descriptor on the GT7288"); -static int command_gt7288_ver(int argc, char **argv) +static int command_gt7288_ver(int argc, const char **argv) { struct gt7288_version_info info; @@ -198,7 +198,7 @@ static int command_gt7288_ver(int argc, char **argv) DECLARE_CONSOLE_COMMAND(gt7288_ver, command_gt7288_ver, "", "Read version information from the GT7288"); -static int command_gt7288_report(int argc, char **argv) +static int command_gt7288_report(int argc, const char **argv) { int i; struct gt7288_ptp_report report; diff --git a/driver/touchpad_st.c b/driver/touchpad_st.c index e5fab5ef7d..87b1a30bc5 100644 --- a/driver/touchpad_st.c +++ b/driver/touchpad_st.c @@ -1801,7 +1801,7 @@ USB_DECLARE_EP(USB_EP_ST_TOUCHPAD_INT, st_tp_interrupt_tx, st_tp_interrupt_tx, #endif /* Debugging commands */ -static int command_touchpad_st(int argc, char **argv) +static int command_touchpad_st(int argc, const char **argv) { if (argc < 2) return EC_ERROR_PARAM_COUNT; diff --git a/driver/usb_mux/usb_mux.c b/driver/usb_mux/usb_mux.c index 778d518e0a..970d06a63d 100644 --- a/driver/usb_mux/usb_mux.c +++ b/driver/usb_mux/usb_mux.c @@ -710,7 +710,7 @@ static void usb_mux_reset_in_g3(void) DECLARE_HOOK(HOOK_CHIPSET_HARD_OFF, usb_mux_reset_in_g3, HOOK_PRIO_DEFAULT); #ifdef CONFIG_CMD_TYPEC -static int command_typec(int argc, char **argv) +static int command_typec(int argc, const char **argv) { const char *const mux_name[] = { "none", "usb", "dp", "dock" }; char *e; diff --git a/driver/wpc/cps8100.c b/driver/wpc/cps8100.c index ffb81e3a91..4fef177fff 100644 --- a/driver/wpc/cps8100.c +++ b/driver/wpc/cps8100.c @@ -399,7 +399,7 @@ static void cps8100_dump(struct pchg *ctx) cps8100_print_alert_info(val); } -static int cc_cps8100(int argc, char **argv) +static int cc_cps8100(int argc, const char **argv) { struct pchg *ctx; char *end; |