aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/softdog.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2017-02-07 15:03:29 +0100
committerGuenter Roeck <linux@roeck-us.net>2017-02-24 14:00:23 -0800
commit4cbc69023a2129c271ed67da555d62eca42469d2 (patch)
treedfeff856480f7d1cd018f3e6b8c90b470fa53967 /drivers/watchdog/softdog.c
parentwatchdog: zx2967: add watchdog controller driver for ZTE's zx2967 family (diff)
downloadlinux-dev-4cbc69023a2129c271ed67da555d62eca42469d2.tar.xz
linux-dev-4cbc69023a2129c271ed67da555d62eca42469d2.zip
watchdog: softdog: make pretimeout support a compile option
It occurred to me that the panic pretimeout governor will stall the softdog, because it is purely software which simply breaks when the kernel panics. Testing governors with the softdog on the other hand is really useful, so make this feature a compile time option which nees to be enabled explicitly. This also removes the overhead if pretimeout support is not used because it will now be compiled away (saving ~10% on ARM32). Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/watchdog/softdog.c')
-rw-r--r--drivers/watchdog/softdog.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
index c7bdc986dca1..7983029852ab 100644
--- a/drivers/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
@@ -87,11 +87,13 @@ static int softdog_ping(struct watchdog_device *w)
if (!mod_timer(&softdog_ticktock, jiffies + (w->timeout * HZ)))
__module_get(THIS_MODULE);
- if (w->pretimeout)
- mod_timer(&softdog_preticktock, jiffies +
- (w->timeout - w->pretimeout) * HZ);
- else
- del_timer(&softdog_preticktock);
+ if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT)) {
+ if (w->pretimeout)
+ mod_timer(&softdog_preticktock, jiffies +
+ (w->timeout - w->pretimeout) * HZ);
+ else
+ del_timer(&softdog_preticktock);
+ }
return 0;
}
@@ -101,15 +103,15 @@ static int softdog_stop(struct watchdog_device *w)
if (del_timer(&softdog_ticktock))
module_put(THIS_MODULE);
- del_timer(&softdog_preticktock);
+ if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT))
+ del_timer(&softdog_preticktock);
return 0;
}
static struct watchdog_info softdog_info = {
.identity = "Software Watchdog",
- .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE |
- WDIOF_PRETIMEOUT,
+ .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
};
static const struct watchdog_ops softdog_ops = {
@@ -134,6 +136,9 @@ static int __init softdog_init(void)
watchdog_set_nowayout(&softdog_dev, nowayout);
watchdog_stop_on_reboot(&softdog_dev);
+ if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT))
+ softdog_info.options |= WDIOF_PRETIMEOUT;
+
ret = watchdog_register_device(&softdog_dev);
if (ret)
return ret;