aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Riegel <damien.riegel@savoirfairelinux.com>2015-11-20 16:54:55 -0500
committerWim Van Sebroeck <wim@iguana.be>2015-12-13 09:56:06 -0500
commit84ebcc17f281ed6ce1e6a7b4b0d9f15da727edd5 (patch)
tree9e703b9bb915909ea8148a6842dc854929dcaec7
parent28e805b44d52900fc5b05b35ef3945dc6db336a1 (diff)
watchdog: softdog: use core reboot notifier
Get rid of the custom reboot notifier block registration and use the one provided by the watchdog core. Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Vivien Didelot <vivien.didelot@savoirlinux.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r--drivers/watchdog/softdog.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
index 0dc5e323d59d..fe1e15137bf6 100644
--- a/drivers/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
@@ -43,7 +43,6 @@
43#include <linux/types.h> 43#include <linux/types.h>
44#include <linux/timer.h> 44#include <linux/timer.h>
45#include <linux/watchdog.h> 45#include <linux/watchdog.h>
46#include <linux/notifier.h>
47#include <linux/reboot.h> 46#include <linux/reboot.h>
48#include <linux/init.h> 47#include <linux/init.h>
49#include <linux/jiffies.h> 48#include <linux/jiffies.h>
@@ -122,26 +121,9 @@ static int softdog_set_timeout(struct watchdog_device *w, unsigned int t)
122} 121}
123 122
124/* 123/*
125 * Notifier for system down
126 */
127
128static int softdog_notify_sys(struct notifier_block *this, unsigned long code,
129 void *unused)
130{
131 if (code == SYS_DOWN || code == SYS_HALT)
132 /* Turn the WDT off */
133 softdog_stop(NULL);
134 return NOTIFY_DONE;
135}
136
137/*
138 * Kernel Interfaces 124 * Kernel Interfaces
139 */ 125 */
140 126
141static struct notifier_block softdog_notifier = {
142 .notifier_call = softdog_notify_sys,
143};
144
145static struct watchdog_info softdog_info = { 127static struct watchdog_info softdog_info = {
146 .identity = "Software Watchdog", 128 .identity = "Software Watchdog",
147 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, 129 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
@@ -175,18 +157,11 @@ static int __init watchdog_init(void)
175 softdog_dev.timeout = soft_margin; 157 softdog_dev.timeout = soft_margin;
176 158
177 watchdog_set_nowayout(&softdog_dev, nowayout); 159 watchdog_set_nowayout(&softdog_dev, nowayout);
178 160 watchdog_stop_on_reboot(&softdog_dev);
179 ret = register_reboot_notifier(&softdog_notifier);
180 if (ret) {
181 pr_err("cannot register reboot notifier (err=%d)\n", ret);
182 return ret;
183 }
184 161
185 ret = watchdog_register_device(&softdog_dev); 162 ret = watchdog_register_device(&softdog_dev);
186 if (ret) { 163 if (ret)
187 unregister_reboot_notifier(&softdog_notifier);
188 return ret; 164 return ret;
189 }
190 165
191 pr_info("Software Watchdog Timer: 0.08 initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout=%d)\n", 166 pr_info("Software Watchdog Timer: 0.08 initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout=%d)\n",
192 soft_noboot, soft_margin, soft_panic, nowayout); 167 soft_noboot, soft_margin, soft_panic, nowayout);
@@ -197,7 +172,6 @@ static int __init watchdog_init(void)
197static void __exit watchdog_exit(void) 172static void __exit watchdog_exit(void)
198{ 173{
199 watchdog_unregister_device(&softdog_dev); 174 watchdog_unregister_device(&softdog_dev);
200 unregister_reboot_notifier(&softdog_notifier);
201} 175}
202 176
203module_init(watchdog_init); 177module_init(watchdog_init);