From: Eduardo Valentin Date: Sat, 12 Feb 2022 02:10:33 +0000 (-0800) Subject: watchdog: aspeed: add nowayout support X-Git-Tag: v6.6.17~7837^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ed1a6b6e66dd9ba0a1d56ed23f46c39fe9368c5;p=platform%2Fkernel%2Flinux-rpi.git 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 (maintainer:WATCHDOG DEVICE DRIVERS) Cc: Guenter Roeck (maintainer:WATCHDOG DEVICE DRIVERS) Cc: Joel Stanley (supporter:ARM/ASPEED MACHINE SUPPORT) Cc: Andrew Jeffery (reviewer:ARM/ASPEED MACHINE SUPPORT) Cc: linux-watchdog@vger.kernel.org (open list:WATCHDOG DEVICE DRIVERS) Cc: linux-arm-kernel@lists.infradead.org (moderated list:ARM/ASPEED MACHINE SUPPORT) Cc: linux-aspeed@lists.ozlabs.org (moderated list:ARM/ASPEED MACHINE SUPPORT) Cc: linux-kernel@vger.kernel.org (open list) Signed-off-by: Eduardo Valentin Signed-off-by: Eduardo Valentin Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220212021033.2344-1-eduval@amazon.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c index 436571b..bd06622 100644 --- a/drivers/watchdog/aspeed_wdt.c +++ b/drivers/watchdog/aspeed_wdt.c @@ -13,6 +13,11 @@ #include #include +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);