diff mbox series

[PATCHv2,2/4] watchdog: reset last_hw_keepalive time at start

Message ID 20200302200426.6492-3-t-kristo@ti.com (mailing list archive)
State Accepted
Headers show
Series watchdog: add TI K3 SoC watchdog support | expand

Commit Message

Tero Kristo March 2, 2020, 8:04 p.m. UTC
Currently the watchdog core does not initialize the last_hw_keepalive
time during watchdog startup. This will cause the watchdog to be pinged
immediately if enough time has passed from the system boot-up time, and
some types of watchdogs like K3 RTI does not like this.

To avoid the issue, setup the last_hw_keepalive time during watchdog
startup.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
v2:
  * apply functionality always instead of being behind a flag

 drivers/watchdog/watchdog_dev.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Guenter Roeck March 3, 2020, 9:12 p.m. UTC | #1
On Mon, Mar 02, 2020 at 10:04:24PM +0200, Tero Kristo wrote:
> Currently the watchdog core does not initialize the last_hw_keepalive
> time during watchdog startup. This will cause the watchdog to be pinged
> immediately if enough time has passed from the system boot-up time, and
> some types of watchdogs like K3 RTI does not like this.
> 
> To avoid the issue, setup the last_hw_keepalive time during watchdog
> startup.
> 
> Signed-off-by: Tero Kristo <t-kristo@ti.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> v2:
>   * apply functionality always instead of being behind a flag
> 
>  drivers/watchdog/watchdog_dev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
> index 8b5c742f24e8..7e4cd34a8c20 100644
> --- a/drivers/watchdog/watchdog_dev.c
> +++ b/drivers/watchdog/watchdog_dev.c
> @@ -282,6 +282,7 @@ static int watchdog_start(struct watchdog_device *wdd)
>  	if (err == 0) {
>  		set_bit(WDOG_ACTIVE, &wdd->status);
>  		wd_data->last_keepalive = started_at;
> +		wd_data->last_hw_keepalive = started_at;
>  		watchdog_update_worker(wdd);
>  	}
>  
> -- 
> 2.17.1
> 
> --
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
diff mbox series

Patch

diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 8b5c742f24e8..7e4cd34a8c20 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -282,6 +282,7 @@  static int watchdog_start(struct watchdog_device *wdd)
 	if (err == 0) {
 		set_bit(WDOG_ACTIVE, &wdd->status);
 		wd_data->last_keepalive = started_at;
+		wd_data->last_hw_keepalive = started_at;
 		watchdog_update_worker(wdd);
 	}