diff options
author | Wim Van Sebroeck <wim@iguana.be> | 2007-01-11 16:42:41 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2007-01-11 16:42:41 -0500 |
commit | 2e9c9cf44b17ef5fa1f360bc175ed7761daf3428 (patch) | |
tree | e3c9bbcc3e547413a0fa5bcd0a7e575401193140 /drivers/char/watchdog/advantechwdt.c | |
parent | c2bd11c7cbba45c3a1d850a8a29855cb4d61654c (diff) |
[WATCHDOG] advantechwdt.c - convert to platform_device part 2
Convert the reboot_notifier into the platform_device's shutdown
method
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char/watchdog/advantechwdt.c')
-rw-r--r-- | drivers/char/watchdog/advantechwdt.c | 46 |
1 files changed, 9 insertions, 37 deletions
diff --git a/drivers/char/watchdog/advantechwdt.c b/drivers/char/watchdog/advantechwdt.c index 528a417856c4..8121cc247343 100644 --- a/drivers/char/watchdog/advantechwdt.c +++ b/drivers/char/watchdog/advantechwdt.c | |||
@@ -35,8 +35,6 @@ | |||
35 | #include <linux/watchdog.h> | 35 | #include <linux/watchdog.h> |
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/ioport.h> | 37 | #include <linux/ioport.h> |
38 | #include <linux/notifier.h> | ||
39 | #include <linux/reboot.h> | ||
40 | #include <linux/platform_device.h> | 38 | #include <linux/platform_device.h> |
41 | #include <linux/init.h> | 39 | #include <linux/init.h> |
42 | 40 | ||
@@ -225,21 +223,6 @@ advwdt_close(struct inode *inode, struct file *file) | |||
225 | } | 223 | } |
226 | 224 | ||
227 | /* | 225 | /* |
228 | * Notifier for system down | ||
229 | */ | ||
230 | |||
231 | static int | ||
232 | advwdt_notify_sys(struct notifier_block *this, unsigned long code, | ||
233 | void *unused) | ||
234 | { | ||
235 | if (code == SYS_DOWN || code == SYS_HALT) { | ||
236 | /* Turn the WDT off */ | ||
237 | advwdt_disable(); | ||
238 | } | ||
239 | return NOTIFY_DONE; | ||
240 | } | ||
241 | |||
242 | /* | ||
243 | * Kernel Interfaces | 226 | * Kernel Interfaces |
244 | */ | 227 | */ |
245 | 228 | ||
@@ -259,15 +242,6 @@ static struct miscdevice advwdt_miscdev = { | |||
259 | }; | 242 | }; |
260 | 243 | ||
261 | /* | 244 | /* |
262 | * The WDT needs to learn about soft shutdowns in order to | ||
263 | * turn the timebomb registers off. | ||
264 | */ | ||
265 | |||
266 | static struct notifier_block advwdt_notifier = { | ||
267 | .notifier_call = advwdt_notify_sys, | ||
268 | }; | ||
269 | |||
270 | /* | ||
271 | * Init & exit routines | 245 | * Init & exit routines |
272 | */ | 246 | */ |
273 | 247 | ||
@@ -299,18 +273,11 @@ advwdt_probe(struct platform_device *dev) | |||
299 | timeout); | 273 | timeout); |
300 | } | 274 | } |
301 | 275 | ||
302 | ret = register_reboot_notifier(&advwdt_notifier); | ||
303 | if (ret != 0) { | ||
304 | printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", | ||
305 | ret); | ||
306 | goto unreg_regions; | ||
307 | } | ||
308 | |||
309 | ret = misc_register(&advwdt_miscdev); | 276 | ret = misc_register(&advwdt_miscdev); |
310 | if (ret != 0) { | 277 | if (ret != 0) { |
311 | printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 278 | printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", |
312 | WATCHDOG_MINOR, ret); | 279 | WATCHDOG_MINOR, ret); |
313 | goto unreg_reboot; | 280 | goto unreg_regions; |
314 | } | 281 | } |
315 | 282 | ||
316 | printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n", | 283 | printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n", |
@@ -318,8 +285,6 @@ advwdt_probe(struct platform_device *dev) | |||
318 | 285 | ||
319 | out: | 286 | out: |
320 | return ret; | 287 | return ret; |
321 | unreg_reboot: | ||
322 | unregister_reboot_notifier(&advwdt_notifier); | ||
323 | unreg_regions: | 288 | unreg_regions: |
324 | release_region(wdt_start, 1); | 289 | release_region(wdt_start, 1); |
325 | unreg_stop: | 290 | unreg_stop: |
@@ -332,7 +297,6 @@ static int __devexit | |||
332 | advwdt_remove(struct platform_device *dev) | 297 | advwdt_remove(struct platform_device *dev) |
333 | { | 298 | { |
334 | misc_deregister(&advwdt_miscdev); | 299 | misc_deregister(&advwdt_miscdev); |
335 | unregister_reboot_notifier(&advwdt_notifier); | ||
336 | release_region(wdt_start,1); | 300 | release_region(wdt_start,1); |
337 | if(wdt_stop != wdt_start) | 301 | if(wdt_stop != wdt_start) |
338 | release_region(wdt_stop,1); | 302 | release_region(wdt_stop,1); |
@@ -340,9 +304,17 @@ advwdt_remove(struct platform_device *dev) | |||
340 | return 0; | 304 | return 0; |
341 | } | 305 | } |
342 | 306 | ||
307 | static void | ||
308 | advwdt_shutdown(struct platform_device *dev) | ||
309 | { | ||
310 | /* Turn the WDT off if we have a soft shutdown */ | ||
311 | advwdt_disable(); | ||
312 | } | ||
313 | |||
343 | static struct platform_driver advwdt_driver = { | 314 | static struct platform_driver advwdt_driver = { |
344 | .probe = advwdt_probe, | 315 | .probe = advwdt_probe, |
345 | .remove = __devexit_p(advwdt_remove), | 316 | .remove = __devexit_p(advwdt_remove), |
317 | .shutdown = advwdt_shutdown, | ||
346 | .driver = { | 318 | .driver = { |
347 | .owner = THIS_MODULE, | 319 | .owner = THIS_MODULE, |
348 | .name = DRV_NAME, | 320 | .name = DRV_NAME, |