Hi Denis,
On 2026-05-22T01:23:09, None <[email protected]> wrote:
> reset: Add explicit cold reset support
>
> Add reset -c to allow explicit cold reset.
>
> Signed-off-by: Denis Mukhin <[email protected]>
>
> drivers/sysreset/sysreset-uclass.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
> diff --git a/drivers/sysreset/sysreset-uclass.c
> b/drivers/sysreset/sysreset-uclass.c
> @@ -162,8 +162,11 @@ int do_reset(struct cmd_tbl *cmdtp, int flag, int argc,
> char *const argv[])
> if (argc > 2)
> return CMD_RET_USAGE;
>
> - if (argc == 2 && argv[1][0] == '-' && argv[1][1] == 'w') {
> - reset_type = SYSRESET_WARM;
> + if (argc == 2 && argv[1][0] == '-') {
> + if (argv[1][1] == 'w')
> + reset_type = SYSRESET_WARM;
> + else if (argv[1][1] == 'c')
> + reset_type = SYSRESET_COLD;
> }
Since you are now parsing more than one sub-option, please return
CMD_RET_USAGE for unknown flags rather than falling through to the
board default. A switch reads more clearly:
switch (argv[1][1]) {
case 'w':
reset_type = SYSRESET_WARM;
break;
case 'c':
reset_type = SYSRESET_COLD;
break;
default:
return CMD_RET_USAGE;
}
> diff --git a/drivers/sysreset/sysreset-uclass.c
> b/drivers/sysreset/sysreset-uclass.c
> @@ -162,8 +162,11 @@ int do_reset(struct cmd_tbl *cmdtp, int flag, int argc,
> char *const argv[])
> + if (argc == 2 && argv[1][0] == '-') {
> + if (argv[1][1] == 'w')
> + reset_type = SYSRESET_WARM;
> + else if (argv[1][1] == 'c')
> + reset_type = SYSRESET_COLD;
> }
The commit message is very terse. Please mention the motivation - with
patch 1 the board default may now be warm, so users need an explicit
way to ask for cold. As written it reads as a duplicate of existing
behaviour.
We should also update doc/usage/cmd/reset.rst
Not sure if we have any tests for the reset command yet, though.
Regards,
Simon