Hi Juuso,

On 2026-07-10T04:51:17, Juuso Rinta <[email protected]> wrote:
> cmd: wdt: add gettimeout command
>
> Add support for the subcommand wdt gettimeout in the U-Boot shell.
>
> The command queries the selected watchdog device and reports its
> timeout when the driver implements get_timeout operation. This
> exposes the timeout printing added to the watchdog uclass to
> the shell interface.
>
> Signed-off-by: Juuso Rinta <[email protected]>
>
> cmd/wdt.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)

> The command queries the selected watchdog device and reports its
> timeout when the driver implements get_timeout operation. This
> exposes the timeout printing added to the watchdog uclass to
> the shell interface.

The command exposes the wdt_get_timeout() helper, not the timeout
printing (which stays in wdt_start()). Please can you adjust this?

> diff --git a/cmd/wdt.c b/cmd/wdt.c
> @@ -162,6 +186,7 @@ U_BOOT_LONGHELP(wdt,
>       "wdt start <timeout ms> [flags] - start watchdog timer\n"
>       "wdt stop - stop watchdog timer\n"
>       "wdt reset - reset watchdog timer\n"
> +     "wdt gettimeout - get device timeout in ms\n"
>       "wdt expire [flags] - expire watchdog timer immediately\n");

This command is documented in doc/usage/cmd/wdt.rst so please can you
update that too, in both the synopsis and the description, ideally
showing the output in the example section?

> diff --git a/cmd/wdt.c b/cmd/wdt.c
> @@ -131,6 +131,30 @@ static int do_wdt_reset(struct cmd_tbl *cmdtp, int flag, 
> int argc,
> +     ret = wdt_get_timeout(currdev, &timeout_ms);
> +     if (ret == -ENOSYS) {
> +             printf("Getting watchdog timeout not supported.\n");
> +             return CMD_RET_FAILURE;
> +     } else if (ret) {
> +             printf("Getting watchdog timeout failed (%d)\n", ret);
> +             return CMD_RET_FAILURE;
> +     }
> +
> +     printf("Timeout: %llums\n", timeout_ms);

The code looks fine and follows the existing pattern in this file.
Since the sandbox driver supports the operation (patch 5), please can
you add a console test in test/dm/wdt.c using ut_assert_nextline() to
check the 'Timeout: ...' line? Patch 6 only covers wdt_get_timeout()
directly.

Regards,
Simon

Reply via email to