Skip to content

Commit cc5cfc1

Browse files
Bharat BhushanWim Van Sebroeck
authored andcommitted
drivers: watchdog: marvell_gti: fix zero pretimeout handling
When pretimeout is set to 0 then do not reprogram timer with zero timeout, this will reset device immediately. Also disable interrupt to stop pretimeout notification. Signed-off-by: Bharat Bhushan <bbhushan2@marvell.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231009044037.514570-1-bbhushan2@marvell.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
1 parent cd09da4 commit cc5cfc1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/watchdog/marvell_gti_wdt.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ static int gti_wdt_set_pretimeout(struct watchdog_device *wdev,
190190
struct gti_wdt_priv *priv = watchdog_get_drvdata(wdev);
191191
struct watchdog_device *wdog_dev = &priv->wdev;
192192

193+
if (!timeout) {
194+
/* Disable Interrupt */
195+
writeq(GTI_CWD_INT_ENA_CLR_VAL(priv->wdt_timer_idx),
196+
priv->base + GTI_CWD_INT_ENA_CLR);
197+
return 0;
198+
}
199+
193200
/* pretimeout should 1/3 of max_timeout */
194201
if (timeout * 3 <= wdog_dev->max_timeout)
195202
return gti_wdt_settimeout(wdev, timeout * 3);

0 commit comments

Comments
 (0)