From: Xiaofeng Wei <xiaofeng.wei@nxp.com>
To: wim@iguana.be, linux-watchdog@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: linux@roeck-us.net, hongjun.chen@nxp.com,
Xiaofeng Wei <xiaofeng.wei@nxp.com>
Subject: [PATCH] watchdog: booke_wdt: Disable the watchdog prior to setting a new timeout value in order to avoid the following situation
Date: Thu, 22 Mar 2018 11:51:46 +0800 [thread overview]
Message-ID: <20180322035146.1236-1-xiaofeng.wei@nxp.com> (raw)
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
next reply other threads:[~2018-03-22 3:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 3:51 Xiaofeng Wei [this message]
2018-03-22 16:47 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180322035146.1236-1-xiaofeng.wei@nxp.com \
--to=xiaofeng.wei@nxp.com \
--cc=hongjun.chen@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=wim@iguana.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome