Skip to contentSkip to conversation

watchdog: aspeed: fix hardware timeout calculation

PATCH In review [email protected] 2 participants 5 messages Apr 17, 2021 – May 21, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: aspeed: fix hardware timeout calculation

From: Tao Ren <[email protected]>

Fix hardware timeout calculation in aspeed_wdt_set_timeout function to ensure the reload value does not exceed the hardware limit.

Fixes efa859f7d786 ("watchdog: Add Aspeed watchdog driver")
---
 drivers/watchdog/aspeed_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/aspeed_wdt.c +1 -1
index 7e00960651fa..507fd815d767 100644
@@ -147,7 +147,7 @@ static int aspeed_wdt_set_timeout(struct watchdog_device *wdd,
 
 	wdd->timeout = timeout;
 
-	actual = min(timeout, wdd->max_hw_heartbeat_ms * 1000);
+	actual = min(timeout, wdd->max_hw_heartbeat_ms / 1000);
 
 	writel(actual * WDT_RATE_1MHZ, wdt->base + WDT_RELOAD_VALUE);
 	writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART);
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · rentao.bupt at gmail.com

From: Tao Ren <[email protected]>

Fix hardware timeout calculation in aspeed_wdt_set_timeout function to ensure the reload value does not exceed the hardware limit.

Fixes efa859f7d786 ("watchdog: Add Aspeed watchdog driver")
Quoted 20 lines
---
 drivers/watchdog/aspeed_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/aspeed_wdt.c +1 -1
index 7e00960651fa..507fd815d767 100644
@@ -147,7 +147,7 @@ static int aspeed_wdt_set_timeout(struct watchdog_device *wdd,
 
 	wdd->timeout = timeout;
 
-	actual = min(timeout, wdd->max_hw_heartbeat_ms * 1000);
+	actual = min(timeout, wdd->max_hw_heartbeat_ms / 1000);
 
 	writel(actual * WDT_RATE_1MHZ, wdt->base + WDT_RELOAD_VALUE);
 	writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART);
Signature · 1 line
2.17.1
author
#2 lore raw

Hi Wim,

Not sure if I looked at the wrong repository/branch, and looks like the patch is not included. Do you have any further suggestions? Or should I send out v2 in case it's missed?

Thanks,

Tao

Quoted 32 lines · Guenter Roeck
Quoted 8 lines · rentao.bupt at gmail.com

From: Tao Ren <[email protected]>

Fix hardware timeout calculation in aspeed_wdt_set_timeout function to ensure the reload value does not exceed the hardware limit.

Fixes efa859f7d786 ("watchdog: Add Aspeed watchdog driver")
Quoted 20 lines
---
 drivers/watchdog/aspeed_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/aspeed_wdt.c +1 -1
index 7e00960651fa..507fd815d767 100644
@@ -147,7 +147,7 @@ static int aspeed_wdt_set_timeout(struct watchdog_device *wdd,
 
 	wdd->timeout = timeout;
 
-	actual = min(timeout, wdd->max_hw_heartbeat_ms * 1000);
+	actual = min(timeout, wdd->max_hw_heartbeat_ms / 1000);
 
 	writel(actual * WDT_RATE_1MHZ, wdt->base + WDT_RELOAD_VALUE);
 	writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART);
Signature · 1 line
2.17.1
maintainer
#3 lore raw
Quoted 6 lines · Tao Ren

Hi Wim,

Not sure if I looked at the wrong repository/branch, and looks like the patch is not included. Do you have any further suggestions? Or should I send out v2 in case it's missed?

Wim didn't send a pull request in this release cycle. I have the patch in my watchdog-next branch, so he'll hopefully pick it up from there at some point.

Resending the patch would just create noise at this point; please don't do that.

Guenter

author
#4 lore raw
Quoted 8 lines · Guenter Roeck
Quoted 6 lines · Tao Ren

Hi Wim,

Not sure if I looked at the wrong repository/branch, and looks like the patch is not included. Do you have any further suggestions? Or should I send out v2 in case it's missed?

Quoted 8 lines

Wim didn't send a pull request in this release cycle. I have the patch in my watchdog-next branch, so he'll hopefully pick it up from there at some point.

Resending the patch would just create noise at this point; please don't do that.

Guenter

Got it. Thanks Guenter.

- Tao