diff mbox series

watchdog: sbsa_gwdt: disable watchdog when system panic was trigged by signal WS0

Message ID 1583138781-40936-1-git-send-email-zhangliguang@linux.alibaba.com
State New
Headers show
Series watchdog: sbsa_gwdt: disable watchdog when system panic was trigged by signal WS0 | expand

Commit Message

乱石 March 2, 2020, 8:46 a.m. UTC
When ARM SBSA Generic Watchdog worked in the two stages mode by setting
module parameter action to 1, when the timeout is reached, the first
signal (WS0) will trigger panic. Before panic, the value of register
SBSA_GWDT_WCS was 0x0, after panic and system startup, the value of
register SBSA_GWDT_WCS was 0x7, status bits SBSA_GWDT_WCS_EN
SBSA_GWDT_WCS_WS0 and SBSA_GWDT_WCS_WS1 were set, this will increase the
refcnt of module sbsa_gwdt by function watchdog_cdev_register because
flag WDOG_HW_RUNNING was set, so we cannot unload the module again. To be
consistent with reboot, watchdog should be disabled when system panic was
trigged by signal(WS0).

Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
---
 drivers/watchdog/sbsa_gwdt.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
index f0f1e3b..6bee5bb 100644
--- a/drivers/watchdog/sbsa_gwdt.c
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -194,6 +194,12 @@  static int sbsa_gwdt_stop(struct watchdog_device *wdd)
 
 static irqreturn_t sbsa_gwdt_interrupt(int irq, void *dev_id)
 {
+	struct sbsa_gwdt *gwdt = (struct sbsa_gwdt *)dev_id;
+	struct watchdog_device *wdd = &gwdt->wdd;
+
+	if (wdd->ops->stop)
+		wdd->ops->stop(wdd);
+
 	panic(WATCHDOG_NAME " timeout");
 
 	return IRQ_HANDLED;