diff options
author | Wim Van Sebroeck <wim@iguana.be> | 2009-12-26 14:13:00 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2010-03-07 05:30:59 -0500 |
commit | 168b5251adddb1554926cfb94f79a8a28bc6ebe5 (patch) | |
tree | d2f7ceac118991d8aa32418074dc599989106432 /drivers/watchdog/bfin_wdt.c | |
parent | 42747d712de56cf2087b702d2ad90af114c53138 (diff) |
[WATCHDOG] change reboot_notifier to platform-shutdown method.
Platform device drivers can use the .shutdown method to handle soft
shutdown's instead of reboot_notifier's.
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/bfin_wdt.c')
-rw-r--r-- | drivers/watchdog/bfin_wdt.c | 52 |
1 files changed, 15 insertions, 37 deletions
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c index 8c6babb2d652..9c7ccd1e9088 100644 --- a/drivers/watchdog/bfin_wdt.c +++ b/drivers/watchdog/bfin_wdt.c | |||
@@ -19,8 +19,6 @@ | |||
19 | #include <linux/miscdevice.h> | 19 | #include <linux/miscdevice.h> |
20 | #include <linux/watchdog.h> | 20 | #include <linux/watchdog.h> |
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/notifier.h> | ||
23 | #include <linux/reboot.h> | ||
24 | #include <linux/init.h> | 22 | #include <linux/init.h> |
25 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
26 | #include <linux/uaccess.h> | 24 | #include <linux/uaccess.h> |
@@ -309,26 +307,6 @@ static long bfin_wdt_ioctl(struct file *file, | |||
309 | } | 307 | } |
310 | } | 308 | } |
311 | 309 | ||
312 | /** | ||
313 | * bfin_wdt_notify_sys - Notifier Handler | ||
314 | * @this: notifier block | ||
315 | * @code: notifier event | ||
316 | * @unused: unused | ||
317 | * | ||
318 | * Handles specific events, such as turning off the watchdog during a | ||
319 | * shutdown event. | ||
320 | */ | ||
321 | static int bfin_wdt_notify_sys(struct notifier_block *this, | ||
322 | unsigned long code, void *unused) | ||
323 | { | ||
324 | stampit(); | ||
325 | |||
326 | if (code == SYS_DOWN || code == SYS_HALT) | ||
327 | bfin_wdt_stop(); | ||
328 | |||
329 | return NOTIFY_DONE; | ||
330 | } | ||
331 | |||
332 | #ifdef CONFIG_PM | 310 | #ifdef CONFIG_PM |
333 | static int state_before_suspend; | 311 | static int state_before_suspend; |
334 | 312 | ||
@@ -395,33 +373,21 @@ static const struct watchdog_info bfin_wdt_info = { | |||
395 | WDIOF_MAGICCLOSE, | 373 | WDIOF_MAGICCLOSE, |
396 | }; | 374 | }; |
397 | 375 | ||
398 | static struct notifier_block bfin_wdt_notifier = { | ||
399 | .notifier_call = bfin_wdt_notify_sys, | ||
400 | }; | ||
401 | |||
402 | /** | 376 | /** |
403 | * bfin_wdt_probe - Initialize module | 377 | * bfin_wdt_probe - Initialize module |
404 | * | 378 | * |
405 | * Registers the misc device and notifier handler. Actual device | 379 | * Registers the misc device. Actual device |
406 | * initialization is handled by bfin_wdt_open(). | 380 | * initialization is handled by bfin_wdt_open(). |
407 | */ | 381 | */ |
408 | static int __devinit bfin_wdt_probe(struct platform_device *pdev) | 382 | static int __devinit bfin_wdt_probe(struct platform_device *pdev) |
409 | { | 383 | { |
410 | int ret; | 384 | int ret; |
411 | 385 | ||
412 | ret = register_reboot_notifier(&bfin_wdt_notifier); | ||
413 | if (ret) { | ||
414 | pr_devinit(KERN_ERR PFX | ||
415 | "cannot register reboot notifier (err=%d)\n", ret); | ||
416 | return ret; | ||
417 | } | ||
418 | |||
419 | ret = misc_register(&bfin_wdt_miscdev); | 386 | ret = misc_register(&bfin_wdt_miscdev); |
420 | if (ret) { | 387 | if (ret) { |
421 | pr_devinit(KERN_ERR PFX | 388 | pr_devinit(KERN_ERR PFX |
422 | "cannot register miscdev on minor=%d (err=%d)\n", | 389 | "cannot register miscdev on minor=%d (err=%d)\n", |
423 | WATCHDOG_MINOR, ret); | 390 | WATCHDOG_MINOR, ret); |
424 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
425 | return ret; | 391 | return ret; |
426 | } | 392 | } |
427 | 393 | ||
@@ -434,21 +400,33 @@ static int __devinit bfin_wdt_probe(struct platform_device *pdev) | |||
434 | /** | 400 | /** |
435 | * bfin_wdt_remove - Initialize module | 401 | * bfin_wdt_remove - Initialize module |
436 | * | 402 | * |
437 | * Unregisters the misc device and notifier handler. Actual device | 403 | * Unregisters the misc device. Actual device |
438 | * deinitialization is handled by bfin_wdt_close(). | 404 | * deinitialization is handled by bfin_wdt_close(). |
439 | */ | 405 | */ |
440 | static int __devexit bfin_wdt_remove(struct platform_device *pdev) | 406 | static int __devexit bfin_wdt_remove(struct platform_device *pdev) |
441 | { | 407 | { |
442 | misc_deregister(&bfin_wdt_miscdev); | 408 | misc_deregister(&bfin_wdt_miscdev); |
443 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
444 | return 0; | 409 | return 0; |
445 | } | 410 | } |
446 | 411 | ||
412 | /** | ||
413 | * bfin_wdt_shutdown - Soft Shutdown Handler | ||
414 | * | ||
415 | * Handles the soft shutdown event. | ||
416 | */ | ||
417 | static void bfin_wdt_shutdown(struct platform_device *pdev) | ||
418 | { | ||
419 | stampit(); | ||
420 | |||
421 | bfin_wdt_stop(); | ||
422 | } | ||
423 | |||
447 | static struct platform_device *bfin_wdt_device; | 424 | static struct platform_device *bfin_wdt_device; |
448 | 425 | ||
449 | static struct platform_driver bfin_wdt_driver = { | 426 | static struct platform_driver bfin_wdt_driver = { |
450 | .probe = bfin_wdt_probe, | 427 | .probe = bfin_wdt_probe, |
451 | .remove = __devexit_p(bfin_wdt_remove), | 428 | .remove = __devexit_p(bfin_wdt_remove), |
429 | .shutdown = bfin_wdt_shutdown, | ||
452 | .suspend = bfin_wdt_suspend, | 430 | .suspend = bfin_wdt_suspend, |
453 | .resume = bfin_wdt_resume, | 431 | .resume = bfin_wdt_resume, |
454 | .driver = { | 432 | .driver = { |