Subject: [PATCH v6 05/19] watchdog: orion: Make sure the watchdog is initially stopped

From: [email-masked] (Guenter Roeck)
Date: Thu, 06 Feb 2014 18:02:56 -0800

On 02/06/2014 09:20 AM, Ezequiel Garcia wrote:
> Having the watchdog initially fully stopped is important to avoid
> any spurious watchdog triggers, in case the registers are not in
> its reset state.
>
> Reviewed-by: Guenter Roeck <[email-masked]>
> Tested-by: Sebastian Hesselbarth <[email-masked]>
> Tested-by: Willy Tarreau <[email-masked]>
> Signed-off-by: Ezequiel Garcia <[email-masked]>
> ---
>   drivers/watchdog/orion_wdt.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
> index 6746033..2dbeee9 100644
> --- a/drivers/watchdog/orion_wdt.c
> +++ b/drivers/watchdog/orion_wdt.c
> @@ -142,6 +142,9 @@ static int orion_wdt_probe(struct platform_device *pdev)
>   	orion_wdt.max_timeout = wdt_max_duration;
>   	watchdog_init_timeout(&orion_wdt, heartbeat, &pdev->dev);
>
> +	/* Let's make sure the watchdog is fully stopped */
> +	orion_wdt_stop(&orion_wdt);
> +

Actually we just had that in another driver, and I stumbled over it there.

Problem with stopping the watchdog in probe unconditionally is that you can
use it to defeat nowayout: unload the module, then load it again,
and the watchdog is stopped even if nowayout is true.

Is this really what you want ? Or, in other words, what is the problem
you are trying to solve ?

Thanks,
Guenter

>   	watchdog_set_nowayout(&orion_wdt, nowayout);
>   	ret = watchdog_register_device(&orion_wdt);
>   	if (ret)
>