diff mbox series

watchdog: rti: of: honor timeout-sec property

Message ID 20241107203830.1068456-1-alexander.sverdlin@siemens.com (mailing list archive)
State New
Headers show
Series watchdog: rti: of: honor timeout-sec property | expand

Commit Message

Sverdlin, Alexander Nov. 7, 2024, 8:38 p.m. UTC
From: Alexander Sverdlin <alexander.sverdlin@siemens.com>

Currently "timeout-sec" Device Tree property is being silently ignored:
even though watchdog_init_timeout() is being used, the driver always passes
"heartbeat" == DEFAULT_HEARTBEAT == 60 as argument.

Fix this by setting struct watchdog_device::timeout to DEFAULT_HEARTBEAT
and passing real module parameter value to watchdog_init_timeout() (which
may now be 0 if not specified).

Cc: stable@vger.kernel.org
Fixes: 2d63908bdbfb ("watchdog: Add K3 RTI watchdog support")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
---
 drivers/watchdog/rti_wdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Guenter Roeck Nov. 7, 2024, 10:24 p.m. UTC | #1
On 11/7/24 12:38, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> 
> Currently "timeout-sec" Device Tree property is being silently ignored:
> even though watchdog_init_timeout() is being used, the driver always passes
> "heartbeat" == DEFAULT_HEARTBEAT == 60 as argument.
> 
> Fix this by setting struct watchdog_device::timeout to DEFAULT_HEARTBEAT
> and passing real module parameter value to watchdog_init_timeout() (which
> may now be 0 if not specified).
> 
> Cc: stable@vger.kernel.org
> Fixes: 2d63908bdbfb ("watchdog: Add K3 RTI watchdog support")
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>

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

> ---
>   drivers/watchdog/rti_wdt.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
> index f410b6e39fb6f..58c9445c0f885 100644
> --- a/drivers/watchdog/rti_wdt.c
> +++ b/drivers/watchdog/rti_wdt.c
> @@ -61,7 +61,7 @@
>   
>   #define MAX_HW_ERROR		250
>   
> -static int heartbeat = DEFAULT_HEARTBEAT;
> +static int heartbeat;
>   
>   /*
>    * struct to hold data for each WDT device
> @@ -252,6 +252,7 @@ static int rti_wdt_probe(struct platform_device *pdev)
>   	wdd->min_timeout = 1;
>   	wdd->max_hw_heartbeat_ms = (WDT_PRELOAD_MAX << WDT_PRELOAD_SHIFT) /
>   		wdt->freq * 1000;
> +	wdd->timeout = DEFAULT_HEARTBEAT;
>   	wdd->parent = dev;
>   
>   	watchdog_set_drvdata(wdd, wdt);
Vignesh Raghavendra Nov. 11, 2024, 6:05 a.m. UTC | #2
On 08/11/24 02:08, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> 
> Currently "timeout-sec" Device Tree property is being silently ignored:
> even though watchdog_init_timeout() is being used, the driver always passes
> "heartbeat" == DEFAULT_HEARTBEAT == 60 as argument.
> 
> Fix this by setting struct watchdog_device::timeout to DEFAULT_HEARTBEAT
> and passing real module parameter value to watchdog_init_timeout() (which
> may now be 0 if not specified).
> 
> Cc: stable@vger.kernel.org
> Fixes: 2d63908bdbfb ("watchdog: Add K3 RTI watchdog support")
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> ---
>  drivers/watchdog/rti_wdt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
> index f410b6e39fb6f..58c9445c0f885 100644
> --- a/drivers/watchdog/rti_wdt.c
> +++ b/drivers/watchdog/rti_wdt.c
> @@ -61,7 +61,7 @@
>  
>  #define MAX_HW_ERROR		250
>  
> -static int heartbeat = DEFAULT_HEARTBEAT;
> +static int heartbeat;
>  
>  /*
>   * struct to hold data for each WDT device
> @@ -252,6 +252,7 @@ static int rti_wdt_probe(struct platform_device *pdev)
>  	wdd->min_timeout = 1;
>  	wdd->max_hw_heartbeat_ms = (WDT_PRELOAD_MAX << WDT_PRELOAD_SHIFT) /
>  		wdt->freq * 1000;
> +	wdd->timeout = DEFAULT_HEARTBEAT;
>  	wdd->parent = dev;
>  
>  	watchdog_set_drvdata(wdd, wdt);


LGTM. Thanks for the fix!

Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
diff mbox series

Patch

diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
index f410b6e39fb6f..58c9445c0f885 100644
--- a/drivers/watchdog/rti_wdt.c
+++ b/drivers/watchdog/rti_wdt.c
@@ -61,7 +61,7 @@ 
 
 #define MAX_HW_ERROR		250
 
-static int heartbeat = DEFAULT_HEARTBEAT;
+static int heartbeat;
 
 /*
  * struct to hold data for each WDT device
@@ -252,6 +252,7 @@  static int rti_wdt_probe(struct platform_device *pdev)
 	wdd->min_timeout = 1;
 	wdd->max_hw_heartbeat_ms = (WDT_PRELOAD_MAX << WDT_PRELOAD_SHIFT) /
 		wdt->freq * 1000;
+	wdd->timeout = DEFAULT_HEARTBEAT;
 	wdd->parent = dev;
 
 	watchdog_set_drvdata(wdd, wdt);