diff mbox series

watchdog: sp805: disable watchdog on remove

Message ID 20220403052249.48784-1-farbere@amazon.com
State New
Headers show
Series watchdog: sp805: disable watchdog on remove | expand

Commit Message

Farber, Eliav April 3, 2022, 5:22 a.m. UTC
Disable the watchdog if it is active while removing the module.
It is necessary in order to prevent a reset in case watchdog
hw was running before the removal.

Signed-off-by: Eliav Farber <farbere@amazon.com>
---
 drivers/watchdog/sp805_wdt.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Farber, Eliav April 14, 2022, 5:27 a.m. UTC | #1
On 4/3/2022 8:41 AM, Guenter Roeck wrote:
> Why not use watchdog_stop_on_unregister() ? 

I'll use watchdog_stop_on_unregister() instead of my change.
diff mbox series

Patch

diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index d8876fba686d..d7dc0f3f16ec 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -311,6 +311,9 @@  static int sp805_wdt_remove(struct amba_device *adev)
 {
 	struct sp805_wdt *wdt = amba_get_drvdata(adev);
 
+	if (watchdog_active(&wdt->wdd))
+		wdt_disable(&wdt->wdd);
+
 	watchdog_unregister_device(&wdt->wdd);
 	watchdog_set_drvdata(&wdt->wdd, NULL);