mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] watchdog: booke_wdt: Disable the watchdog prior to setting a new timeout value in order to avoid the following situation
@ 2018-03-22  3:51 Xiaofeng Wei
  2018-03-22 16:47 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Xiaofeng Wei @ 2018-03-22  3:51 UTC (permalink / raw)
  To: wim, linux-watchdog, linux-kernel; +Cc: linux, hongjun.chen, Xiaofeng Wei

A watchdog timer exception also occurs if the selected time base bit transitions from 0 to 1 due
to an mtspr that writes a 1 to the bit when its previous value was 0.

Signed-off-by: Xiaofeng Wei <xiaofeng.wei@nxp.com>
---
 drivers/watchdog/booke_wdt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index 3ad1e44..70e742c 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -186,9 +186,15 @@ static int booke_wdt_stop(struct watchdog_device *wdog)
 static int booke_wdt_set_timeout(struct watchdog_device *wdt_dev,
 				 unsigned int timeout)
 {
+	if (watchdog_active(wdt_dev))
+		on_each_cpu(__booke_wdt_disable, NULL, 0);
+
 	wdt_dev->timeout = timeout;
 	booke_wdt_set(wdt_dev);
 
+	if (watchdog_active(wdt_dev))
+		on_each_cpu(__booke_wdt_enable, wdt_dev, 0);
+
 	return 0;
 }
 
-- 
2.9.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-22 16:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22  3:51 [PATCH] watchdog: booke_wdt: Disable the watchdog prior to setting a new timeout value in order to avoid the following situation Xiaofeng Wei
2018-03-22 16:47 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®