This is an automated email from the ASF dual-hosted git repository. jerzy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 15a3bfcad25d949df9a0be247b5ff3c31ac64ac1 Author: Jerzy Kasenberg <[email protected]> AuthorDate: Fri Jun 6 19:21:44 2025 +0200 drivers/adp5061: Register command statically Now adp5061 shell command is registered at link time to reduce memory footprint. No change in functionality. Signed-off-by: Jerzy Kasenberg <[email protected]> --- hw/drivers/chg_ctrl/adp5061/pkg.yml | 2 ++ hw/drivers/chg_ctrl/adp5061/src/adp5061.c | 4 ---- hw/drivers/chg_ctrl/adp5061/src/adp5061_shell.c | 17 ++++------------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/hw/drivers/chg_ctrl/adp5061/pkg.yml b/hw/drivers/chg_ctrl/adp5061/pkg.yml index 8bc3c8df4..41af0bf6a 100644 --- a/hw/drivers/chg_ctrl/adp5061/pkg.yml +++ b/hw/drivers/chg_ctrl/adp5061/pkg.yml @@ -39,3 +39,5 @@ pkg.deps.!BUS_DRIVER_PRESENT||ADP5061_USE_CHARGE_CONTROL: pkg.deps.ADP5061_CLI: - '@apache-mynewt-core/sys/shell' - '@apache-mynewt-core/util/parse' + +pkg.whole_archive: true diff --git a/hw/drivers/chg_ctrl/adp5061/src/adp5061.c b/hw/drivers/chg_ctrl/adp5061/src/adp5061.c index 6e681d6c7..7a15a77e0 100644 --- a/hw/drivers/chg_ctrl/adp5061/src/adp5061.c +++ b/hw/drivers/chg_ctrl/adp5061/src/adp5061.c @@ -674,10 +674,6 @@ adp5061_init(struct os_dev *dev, void *arg) } #endif /* ADP5061_USE_CHARGE_CONTROL */ -#if MYNEWT_VAL(ADP5061_CLI) - adp5061_shell_init(adp5061); -#endif - return 0; err: return rc; diff --git a/hw/drivers/chg_ctrl/adp5061/src/adp5061_shell.c b/hw/drivers/chg_ctrl/adp5061/src/adp5061_shell.c index 184b78732..0cad5dbe1 100644 --- a/hw/drivers/chg_ctrl/adp5061/src/adp5061_shell.c +++ b/hw/drivers/chg_ctrl/adp5061/src/adp5061_shell.c @@ -624,13 +624,6 @@ static const struct adp5061_reg adp5061_device_regs[] = { #define NUM_DEVICE_REGS (sizeof(adp5061_device_regs)\ /sizeof(adp5061_device_regs[0])) -static int adp5061_shell_cmd(int argc, char **argv); - -static const struct shell_cmd adp5061_shell_cmd_struct = { - .sc_cmd = "adp5061", - .sc_cmd_func = adp5061_shell_cmd -}; - static int adp5061_shell_err_too_many_args(const char *cmd_name) { @@ -665,7 +658,7 @@ adp5061_shell_err_missing_arg(const char *cmd_name) static int adp5061_shell_help(void) { - console_printf("%s cmd\n", adp5061_shell_cmd_struct.sc_cmd); + console_printf("adp5061 cmd\n"); console_printf("cmd:\n"); console_printf("\thelp\n"); #if MYNEWT_VAL(ADP5061_CLI_DECODE) @@ -970,16 +963,14 @@ adp5061_shell_cmd(int argc, char **argv) return adp5061_shell_err_unknown_arg(argv[1]); } +MAKE_SHELL_CMD(adp5061, adp5061_shell_cmd, NULL); + int adp5061_shell_init(struct adp5061_dev *dev) { - int rc; - adp5061_dev = dev; - rc = shell_cmd_register(&adp5061_shell_cmd_struct); - SYSINIT_PANIC_ASSERT(rc == 0); - return rc; + return 0; } #endif
