diff options
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/Kconfig | 8 | ||||
-rw-r--r-- | drivers/watchdog/softdog.c | 21 |
2 files changed, 21 insertions, 8 deletions
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 2d006d8cfb15..1a4d6ca8028d 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -71,6 +71,14 @@ config SOFT_WATCHDOG | |||
71 | To compile this driver as a module, choose M here: the | 71 | To compile this driver as a module, choose M here: the |
72 | module will be called softdog. | 72 | module will be called softdog. |
73 | 73 | ||
74 | config SOFT_WATCHDOG_PRETIMEOUT | ||
75 | bool "Software watchdog pretimeout governor support" | ||
76 | depends on SOFT_WATCHDOG && WATCHDOG_PRETIMEOUT_GOV | ||
77 | help | ||
78 | Enable this if you want to use pretimeout governors with the software | ||
79 | watchdog. Be aware that governors might affect the watchdog because it | ||
80 | is purely software, e.g. the panic governor will stall it! | ||
81 | |||
74 | config DA9052_WATCHDOG | 82 | config DA9052_WATCHDOG |
75 | tristate "Dialog DA9052 Watchdog" | 83 | tristate "Dialog DA9052 Watchdog" |
76 | depends on PMIC_DA9052 || COMPILE_TEST | 84 | depends on PMIC_DA9052 || COMPILE_TEST |
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) | |||
87 | if (!mod_timer(&softdog_ticktock, jiffies + (w->timeout * HZ))) | 87 | if (!mod_timer(&softdog_ticktock, jiffies + (w->timeout * HZ))) |
88 | __module_get(THIS_MODULE); | 88 | __module_get(THIS_MODULE); |
89 | 89 | ||
90 | if (w->pretimeout) | 90 | if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT)) { |
91 | mod_timer(&softdog_preticktock, jiffies + | 91 | if (w->pretimeout) |
92 | (w->timeout - w->pretimeout) * HZ); | 92 | mod_timer(&softdog_preticktock, jiffies + |
93 | else | 93 | (w->timeout - w->pretimeout) * HZ); |
94 | del_timer(&softdog_preticktock); | 94 | else |
95 | del_timer(&softdog_preticktock); | ||
96 | } | ||
95 | 97 | ||
96 | return 0; | 98 | return 0; |
97 | } | 99 | } |
@@ -101,15 +103,15 @@ static int softdog_stop(struct watchdog_device *w) | |||
101 | if (del_timer(&softdog_ticktock)) | 103 | if (del_timer(&softdog_ticktock)) |
102 | module_put(THIS_MODULE); | 104 | module_put(THIS_MODULE); |
103 | 105 | ||
104 | del_timer(&softdog_preticktock); | 106 | if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT)) |
107 | del_timer(&softdog_preticktock); | ||
105 | 108 | ||
106 | return 0; | 109 | return 0; |
107 | } | 110 | } |
108 | 111 | ||
109 | static struct watchdog_info softdog_info = { | 112 | static struct watchdog_info softdog_info = { |
110 | .identity = "Software Watchdog", | 113 | .identity = "Software Watchdog", |
111 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE | | 114 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
112 | WDIOF_PRETIMEOUT, | ||
113 | }; | 115 | }; |
114 | 116 | ||
115 | static const struct watchdog_ops softdog_ops = { | 117 | static const struct watchdog_ops softdog_ops = { |
@@ -134,6 +136,9 @@ static int __init softdog_init(void) | |||
134 | watchdog_set_nowayout(&softdog_dev, nowayout); | 136 | watchdog_set_nowayout(&softdog_dev, nowayout); |
135 | watchdog_stop_on_reboot(&softdog_dev); | 137 | watchdog_stop_on_reboot(&softdog_dev); |
136 | 138 | ||
139 | if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT)) | ||
140 | softdog_info.options |= WDIOF_PRETIMEOUT; | ||
141 | |||
137 | ret = watchdog_register_device(&softdog_dev); | 142 | ret = watchdog_register_device(&softdog_dev); |
138 | if (ret) | 143 | if (ret) |
139 | return ret; | 144 | return ret; |