summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksij Rempel <o.rempel@pengutronix.de>2017-09-26 08:11:22 +0200
committerZiyuan Xu <xzy.xu@rock-chips.com>2019-03-12 16:21:28 +0800
commit5d1f66da5a3859f740d14df3357dd764191c26bc (patch)
tree70fb3790d89243dd8c248dc3ba10b586a6045b0d
parent328f02596a27fb38f46979afac04d00aaa16b8d9 (diff)
BACKPORT: watchdog: dw_wdt: add stop watchdog operation
The only way of stopping the watchdog is by resetting it. Add the watchdog op for stopping the device and reset if a reset line is provided. At same time WDOG_HW_RUNNING should be remove from dw_wdt_start. As commented by Guenter Roeck: dw_wdt sets WDOG_HW_RUNNING in its open function. Result is that the kref_get() in watchdog_open() won't be executed. But then kref_put() in close will be called since the watchdog now does stop. This causes the imbalance. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Cc: Wim Van Sebroeck <wim@iguana.be> Cc: Guenter Roeck <linux@roeck-us.net> Cc: linux-watchdog@vger.kernel.org Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be> (cherry picked from commit 1bfe8889380890efe4943d125124f5a7b48571b0) Conflicts: drivers/watchdog/dw_wdt.c Change-Id: Ia6f4e16011b61f78c09b5c54669ddd18678357b9 Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
-rw-r--r--drivers/watchdog/dw_wdt.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index 8c2021a79708..02acc81337da 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -297,6 +297,11 @@ static int dw_wdt_release(struct inode *inode, struct file *filp)
pr_crit("watchdog cannot be disabled, system will reboot soon\n");
}
+ if (!IS_ERR(dw_wdt.rst)) {
+ reset_control_assert(dw_wdt.rst);
+ reset_control_deassert(dw_wdt.rst);
+ }
+
dw_wdt.expect_close = 0;
return 0;