diff options
-rw-r--r-- | drivers/watchdog/gpio_wdt.c | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c index 90d59d3f38a3..035c2387b846 100644 --- a/drivers/watchdog/gpio_wdt.c +++ b/drivers/watchdog/gpio_wdt.c | |||
@@ -12,10 +12,8 @@ | |||
12 | #include <linux/err.h> | 12 | #include <linux/err.h> |
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/notifier.h> | ||
16 | #include <linux/of_gpio.h> | 15 | #include <linux/of_gpio.h> |
17 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
18 | #include <linux/reboot.h> | ||
19 | #include <linux/watchdog.h> | 17 | #include <linux/watchdog.h> |
20 | 18 | ||
21 | #define SOFT_TIMEOUT_MIN 1 | 19 | #define SOFT_TIMEOUT_MIN 1 |
@@ -36,7 +34,6 @@ struct gpio_wdt_priv { | |||
36 | unsigned int hw_algo; | 34 | unsigned int hw_algo; |
37 | unsigned int hw_margin; | 35 | unsigned int hw_margin; |
38 | unsigned long last_jiffies; | 36 | unsigned long last_jiffies; |
39 | struct notifier_block notifier; | ||
40 | struct timer_list timer; | 37 | struct timer_list timer; |
41 | struct watchdog_device wdd; | 38 | struct watchdog_device wdd; |
42 | }; | 39 | }; |
@@ -126,26 +123,6 @@ static int gpio_wdt_set_timeout(struct watchdog_device *wdd, unsigned int t) | |||
126 | return gpio_wdt_ping(wdd); | 123 | return gpio_wdt_ping(wdd); |
127 | } | 124 | } |
128 | 125 | ||
129 | static int gpio_wdt_notify_sys(struct notifier_block *nb, unsigned long code, | ||
130 | void *unused) | ||
131 | { | ||
132 | struct gpio_wdt_priv *priv = container_of(nb, struct gpio_wdt_priv, | ||
133 | notifier); | ||
134 | |||
135 | mod_timer(&priv->timer, 0); | ||
136 | |||
137 | switch (code) { | ||
138 | case SYS_HALT: | ||
139 | case SYS_POWER_OFF: | ||
140 | gpio_wdt_disable(priv); | ||
141 | break; | ||
142 | default: | ||
143 | break; | ||
144 | } | ||
145 | |||
146 | return NOTIFY_DONE; | ||
147 | } | ||
148 | |||
149 | static const struct watchdog_info gpio_wdt_ident = { | 126 | static const struct watchdog_info gpio_wdt_ident = { |
150 | .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | | 127 | .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | |
151 | WDIOF_SETTIMEOUT, | 128 | WDIOF_SETTIMEOUT, |
@@ -224,23 +201,16 @@ static int gpio_wdt_probe(struct platform_device *pdev) | |||
224 | 201 | ||
225 | setup_timer(&priv->timer, gpio_wdt_hwping, (unsigned long)&priv->wdd); | 202 | setup_timer(&priv->timer, gpio_wdt_hwping, (unsigned long)&priv->wdd); |
226 | 203 | ||
204 | watchdog_stop_on_reboot(&priv->wdd); | ||
205 | |||
227 | ret = watchdog_register_device(&priv->wdd); | 206 | ret = watchdog_register_device(&priv->wdd); |
228 | if (ret) | 207 | if (ret) |
229 | return ret; | 208 | return ret; |
230 | 209 | ||
231 | priv->notifier.notifier_call = gpio_wdt_notify_sys; | ||
232 | ret = register_reboot_notifier(&priv->notifier); | ||
233 | if (ret) | ||
234 | goto error_unregister; | ||
235 | |||
236 | if (priv->always_running) | 210 | if (priv->always_running) |
237 | gpio_wdt_start_impl(priv); | 211 | gpio_wdt_start_impl(priv); |
238 | 212 | ||
239 | return 0; | 213 | return 0; |
240 | |||
241 | error_unregister: | ||
242 | watchdog_unregister_device(&priv->wdd); | ||
243 | return ret; | ||
244 | } | 214 | } |
245 | 215 | ||
246 | static int gpio_wdt_remove(struct platform_device *pdev) | 216 | static int gpio_wdt_remove(struct platform_device *pdev) |
@@ -248,7 +218,6 @@ static int gpio_wdt_remove(struct platform_device *pdev) | |||
248 | struct gpio_wdt_priv *priv = platform_get_drvdata(pdev); | 218 | struct gpio_wdt_priv *priv = platform_get_drvdata(pdev); |
249 | 219 | ||
250 | del_timer_sync(&priv->timer); | 220 | del_timer_sync(&priv->timer); |
251 | unregister_reboot_notifier(&priv->notifier); | ||
252 | watchdog_unregister_device(&priv->wdd); | 221 | watchdog_unregister_device(&priv->wdd); |
253 | 222 | ||
254 | return 0; | 223 | return 0; |