diff options
author | Wim Van Sebroeck <wim@iguana.be> | 2007-12-26 15:32:51 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2008-01-25 15:31:50 -0500 |
commit | c6cb13aead3a3cf5bd3e2cfa945602d5cd7825cd (patch) | |
tree | ecff4a444e33d0ca24925e92fee4f9021ba981b8 /drivers/watchdog/alim1535_wdt.c | |
parent | 01c785dcb4e9fd6c4c370fd9915fc10585ed64bd (diff) |
[WATCHDOG] misc_register patch
Make sure that we first do a register_reboot_notifier before we
do a misc_register. A misc_register opens the interface to
userspace and it's best to do this as the last action.
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/alim1535_wdt.c')
-rw-r--r-- | drivers/watchdog/alim1535_wdt.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c index b481cc0e32e4..2b1fbdb2fcf7 100644 --- a/drivers/watchdog/alim1535_wdt.c +++ b/drivers/watchdog/alim1535_wdt.c | |||
@@ -413,18 +413,18 @@ static int __init watchdog_init(void) | |||
413 | /* Calculate the watchdog's timeout */ | 413 | /* Calculate the watchdog's timeout */ |
414 | ali_settimer(timeout); | 414 | ali_settimer(timeout); |
415 | 415 | ||
416 | ret = misc_register(&ali_miscdev); | 416 | ret = register_reboot_notifier(&ali_notifier); |
417 | if (ret != 0) { | 417 | if (ret != 0) { |
418 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 418 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", |
419 | WATCHDOG_MINOR, ret); | 419 | ret); |
420 | goto out; | 420 | goto out; |
421 | } | 421 | } |
422 | 422 | ||
423 | ret = register_reboot_notifier(&ali_notifier); | 423 | ret = misc_register(&ali_miscdev); |
424 | if (ret != 0) { | 424 | if (ret != 0) { |
425 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", | 425 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", |
426 | ret); | 426 | WATCHDOG_MINOR, ret); |
427 | goto unreg_miscdev; | 427 | goto unreg_reboot; |
428 | } | 428 | } |
429 | 429 | ||
430 | printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n", | 430 | printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n", |
@@ -432,8 +432,8 @@ static int __init watchdog_init(void) | |||
432 | 432 | ||
433 | out: | 433 | out: |
434 | return ret; | 434 | return ret; |
435 | unreg_miscdev: | 435 | unreg_reboot: |
436 | misc_deregister(&ali_miscdev); | 436 | unregister_reboot_notifier(&ali_notifier); |
437 | goto out; | 437 | goto out; |
438 | } | 438 | } |
439 | 439 | ||
@@ -449,8 +449,8 @@ static void __exit watchdog_exit(void) | |||
449 | ali_stop(); | 449 | ali_stop(); |
450 | 450 | ||
451 | /* Deregister */ | 451 | /* Deregister */ |
452 | unregister_reboot_notifier(&ali_notifier); | ||
453 | misc_deregister(&ali_miscdev); | 452 | misc_deregister(&ali_miscdev); |
453 | unregister_reboot_notifier(&ali_notifier); | ||
454 | pci_dev_put(ali_pci); | 454 | pci_dev_put(ali_pci); |
455 | } | 455 | } |
456 | 456 | ||