Skip to contentSkip to conversation

watchdog: sp805: disable watchdog on remove

PATCH Superseded Eliav Farber 2 participants 3 messages Apr 3, 2022 – Apr 14, 2022 Watchdog device drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: sp805: disable watchdog on remove

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.

---
 drivers/watchdog/sp805_wdt.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/watchdog/sp805_wdt.c +3 -0
index d8876fba686d..d7dc0f3f16ec 100644
@@ -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);
 
Signature · 1 line
2.32.0
maintainer
#1 lore raw
Quoted 14 lines · Eliav Farber

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.

---
  drivers/watchdog/sp805_wdt.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/watchdog/sp805_wdt.c +0 -0
index d8876fba686d..d7dc0f3f16ec 100644

drivers/watchdog/sp805_wdt.c static int sp805_wdt_remove(struct amba_device *adev) · line 316

Quoted 6 lines
drivers/watchdog/sp805_wdt.c +3 -0
@@ -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);
+

Why not use watchdog_stop_on_unregister() ?

Guenter

Quoted 3 lines
drivers/watchdog/sp805_wdt.c +0 -0
  	watchdog_unregister_device(&wdt->wdd);
  	watchdog_set_drvdata(&wdt->wdd, NULL);
 
#2 lore raw
Quoted 1 line · Guenter Roeck

Why not use watchdog_stop_on_unregister() ?

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