Skip to contentSkip to conversation

watchdog: aspeed: add nowayout support

PATCH In review Eduardo Valentin 2 participants 2 messages Feb 12, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: aspeed: add nowayout support

Add support for not stopping the watchdog
when the userspace application quits. At
closing of the device, the driver cannot
determine if this was a graceful closure
or if the app crashed. If the support
of nowayout on this driver, the system integrator
can select the behaviour by setting the kernel
config and enabling it.

Cc Wim Van Sebroeck <[email protected]> (maintainer:WATCHDOG DEVICE DRIVERS)
Cc Guenter Roeck <[email protected]> (maintainer:WATCHDOG DEVICE DRIVERS)
Cc Joel Stanley <[email protected]> (supporter:ARM/ASPEED MACHINE SUPPORT)
Cc Andrew Jeffery <[email protected]> (reviewer:ARM/ASPEED MACHINE SUPPORT)
Cc linux-watchdog at vger.kernel.org (open list:WATCHDOG DEVICE DRIVERS)
Cc linux-arm-kernel at lists.infradead.org (moderated list:ARM/ASPEED MACHINE SUPPORT)
Cc linux-aspeed at lists.ozlabs.org (moderated list:ARM/ASPEED MACHINE SUPPORT)
Cc linux-kernel at vger.kernel.org (open list)
---
 drivers/watchdog/aspeed_wdt.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/watchdog/aspeed_wdt.c +7 -0
index 436571b6fc79..bd06622813eb 100644
@@ -13,6 +13,11 @@
 #include <linux/platform_device.h>
 #include <linux/watchdog.h>
 
+static bool nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, bool, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
+				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
 struct aspeed_wdt {
 	struct watchdog_device	wdd;
 	void __iomem		*base;
@@ -266,6 +271,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
 	wdt->wdd.timeout = WDT_DEFAULT_TIMEOUT;
 	watchdog_init_timeout(&wdt->wdd, 0, dev);
 
+	watchdog_set_nowayout(&wdt->wdd, nowayout);
+
 	np = dev->of_node;
 
 	ofdid = of_match_node(aspeed_wdt_of_table, np);
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eduardo Valentin

Add support for not stopping the watchdog
when the userspace application quits. At
closing of the device, the driver cannot
determine if this was a graceful closure
or if the app crashed. If the support
of nowayout on this driver, the system integrator
can select the behaviour by setting the kernel
config and enabling it.

Quoted 10 lines
Cc Wim Van Sebroeck <[email protected]> (maintainer:WATCHDOG DEVICE DRIVERS)
Cc Guenter Roeck <[email protected]> (maintainer:WATCHDOG DEVICE DRIVERS)
Cc Joel Stanley <[email protected]> (supporter:ARM/ASPEED MACHINE SUPPORT)
Cc Andrew Jeffery <[email protected]> (reviewer:ARM/ASPEED MACHINE SUPPORT)
Cc linux-watchdog at vger.kernel.org (open list:WATCHDOG DEVICE DRIVERS)
Cc linux-arm-kernel at lists.infradead.org (moderated list:ARM/ASPEED MACHINE SUPPORT)
Cc linux-aspeed at lists.ozlabs.org (moderated list:ARM/ASPEED MACHINE SUPPORT)
Cc linux-kernel at vger.kernel.org (open list)
Quoted 29 lines
---
  drivers/watchdog/aspeed_wdt.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/watchdog/aspeed_wdt.c +7 -0
index 436571b6fc79..bd06622813eb 100644
@@ -13,6 +13,11 @@
  #include <linux/platform_device.h>
  #include <linux/watchdog.h>
 
+static bool nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, bool, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
+				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
  struct aspeed_wdt {
  	struct watchdog_device	wdd;
  	void __iomem		*base;
@@ -266,6 +271,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
  	wdt->wdd.timeout = WDT_DEFAULT_TIMEOUT;
  	watchdog_init_timeout(&wdt->wdd, 0, dev);
 
+	watchdog_set_nowayout(&wdt->wdd, nowayout);
+
  	np = dev->of_node;
 
  	ofdid = of_match_node(aspeed_wdt_of_table, np);