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 | |
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')
-rw-r--r-- | drivers/watchdog/alim1535_wdt.c | 20 | ||||
-rw-r--r-- | drivers/watchdog/alim7101_wdt.c | 18 | ||||
-rw-r--r-- | drivers/watchdog/sbc60xxwdt.c | 18 | ||||
-rw-r--r-- | drivers/watchdog/scx200_wdt.c | 10 | ||||
-rw-r--r-- | drivers/watchdog/w83877f_wdt.c | 18 | ||||
-rw-r--r-- | drivers/watchdog/w83977f_wdt.c | 18 | ||||
-rw-r--r-- | drivers/watchdog/wdt977.c | 18 |
7 files changed, 60 insertions, 60 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 | ||
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c index 67aed9f8c362..238273c98656 100644 --- a/drivers/watchdog/alim7101_wdt.c +++ b/drivers/watchdog/alim7101_wdt.c | |||
@@ -377,18 +377,18 @@ static int __init alim7101_wdt_init(void) | |||
377 | timeout); | 377 | timeout); |
378 | } | 378 | } |
379 | 379 | ||
380 | rc = misc_register(&wdt_miscdev); | 380 | rc = register_reboot_notifier(&wdt_notifier); |
381 | if (rc) { | 381 | if (rc) { |
382 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 382 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", |
383 | wdt_miscdev.minor, rc); | 383 | rc); |
384 | goto err_out; | 384 | goto err_out; |
385 | } | 385 | } |
386 | 386 | ||
387 | rc = register_reboot_notifier(&wdt_notifier); | 387 | rc = misc_register(&wdt_miscdev); |
388 | if (rc) { | 388 | if (rc) { |
389 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", | 389 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", |
390 | rc); | 390 | wdt_miscdev.minor, rc); |
391 | goto err_out_miscdev; | 391 | goto err_out_reboot; |
392 | } | 392 | } |
393 | 393 | ||
394 | if (nowayout) { | 394 | if (nowayout) { |
@@ -399,8 +399,8 @@ static int __init alim7101_wdt_init(void) | |||
399 | timeout, nowayout); | 399 | timeout, nowayout); |
400 | return 0; | 400 | return 0; |
401 | 401 | ||
402 | err_out_miscdev: | 402 | err_out_reboot: |
403 | misc_deregister(&wdt_miscdev); | 403 | unregister_reboot_notifier(&wdt_notifier); |
404 | err_out: | 404 | err_out: |
405 | pci_dev_put(alim7101_pmu); | 405 | pci_dev_put(alim7101_pmu); |
406 | return rc; | 406 | return rc; |
diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c index e4f3cb6090bc..ef76f01625e7 100644 --- a/drivers/watchdog/sbc60xxwdt.c +++ b/drivers/watchdog/sbc60xxwdt.c | |||
@@ -359,20 +359,20 @@ static int __init sbc60xxwdt_init(void) | |||
359 | } | 359 | } |
360 | } | 360 | } |
361 | 361 | ||
362 | rc = misc_register(&wdt_miscdev); | 362 | rc = register_reboot_notifier(&wdt_notifier); |
363 | if (rc) | 363 | if (rc) |
364 | { | 364 | { |
365 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 365 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", |
366 | wdt_miscdev.minor, rc); | 366 | rc); |
367 | goto err_out_region2; | 367 | goto err_out_region2; |
368 | } | 368 | } |
369 | 369 | ||
370 | rc = register_reboot_notifier(&wdt_notifier); | 370 | rc = misc_register(&wdt_miscdev); |
371 | if (rc) | 371 | if (rc) |
372 | { | 372 | { |
373 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", | 373 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", |
374 | rc); | 374 | wdt_miscdev.minor, rc); |
375 | goto err_out_miscdev; | 375 | goto err_out_reboot; |
376 | } | 376 | } |
377 | 377 | ||
378 | printk(KERN_INFO PFX "WDT driver for 60XX single board computer initialised. timeout=%d sec (nowayout=%d)\n", | 378 | printk(KERN_INFO PFX "WDT driver for 60XX single board computer initialised. timeout=%d sec (nowayout=%d)\n", |
@@ -380,8 +380,8 @@ static int __init sbc60xxwdt_init(void) | |||
380 | 380 | ||
381 | return 0; | 381 | return 0; |
382 | 382 | ||
383 | err_out_miscdev: | 383 | err_out_reboot: |
384 | misc_deregister(&wdt_miscdev); | 384 | unregister_reboot_notifier(&wdt_notifier); |
385 | err_out_region2: | 385 | err_out_region2: |
386 | if ((wdt_stop != 0x45) && (wdt_stop != wdt_start)) | 386 | if ((wdt_stop != 0x45) && (wdt_stop != wdt_start)) |
387 | release_region(wdt_stop,1); | 387 | release_region(wdt_stop,1); |
diff --git a/drivers/watchdog/scx200_wdt.c b/drivers/watchdog/scx200_wdt.c index d4fd0fa2f176..d55882bca319 100644 --- a/drivers/watchdog/scx200_wdt.c +++ b/drivers/watchdog/scx200_wdt.c | |||
@@ -231,17 +231,17 @@ static int __init scx200_wdt_init(void) | |||
231 | 231 | ||
232 | sema_init(&open_semaphore, 1); | 232 | sema_init(&open_semaphore, 1); |
233 | 233 | ||
234 | r = misc_register(&scx200_wdt_miscdev); | 234 | r = register_reboot_notifier(&scx200_wdt_notifier); |
235 | if (r) { | 235 | if (r) { |
236 | printk(KERN_ERR NAME ": unable to register reboot notifier"); | ||
236 | release_region(scx200_cb_base + SCx200_WDT_OFFSET, | 237 | release_region(scx200_cb_base + SCx200_WDT_OFFSET, |
237 | SCx200_WDT_SIZE); | 238 | SCx200_WDT_SIZE); |
238 | return r; | 239 | return r; |
239 | } | 240 | } |
240 | 241 | ||
241 | r = register_reboot_notifier(&scx200_wdt_notifier); | 242 | r = misc_register(&scx200_wdt_miscdev); |
242 | if (r) { | 243 | if (r) { |
243 | printk(KERN_ERR NAME ": unable to register reboot notifier"); | 244 | unregister_reboot_notifier(&scx200_wdt_notifier); |
244 | misc_deregister(&scx200_wdt_miscdev); | ||
245 | release_region(scx200_cb_base + SCx200_WDT_OFFSET, | 245 | release_region(scx200_cb_base + SCx200_WDT_OFFSET, |
246 | SCx200_WDT_SIZE); | 246 | SCx200_WDT_SIZE); |
247 | return r; | 247 | return r; |
@@ -252,8 +252,8 @@ static int __init scx200_wdt_init(void) | |||
252 | 252 | ||
253 | static void __exit scx200_wdt_cleanup(void) | 253 | static void __exit scx200_wdt_cleanup(void) |
254 | { | 254 | { |
255 | unregister_reboot_notifier(&scx200_wdt_notifier); | ||
256 | misc_deregister(&scx200_wdt_miscdev); | 255 | misc_deregister(&scx200_wdt_miscdev); |
256 | unregister_reboot_notifier(&scx200_wdt_notifier); | ||
257 | release_region(scx200_cb_base + SCx200_WDT_OFFSET, | 257 | release_region(scx200_cb_base + SCx200_WDT_OFFSET, |
258 | SCx200_WDT_SIZE); | 258 | SCx200_WDT_SIZE); |
259 | } | 259 | } |
diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c index bcc9d48955de..f510a3a595e6 100644 --- a/drivers/watchdog/w83877f_wdt.c +++ b/drivers/watchdog/w83877f_wdt.c | |||
@@ -373,20 +373,20 @@ static int __init w83877f_wdt_init(void) | |||
373 | goto err_out_region1; | 373 | goto err_out_region1; |
374 | } | 374 | } |
375 | 375 | ||
376 | rc = misc_register(&wdt_miscdev); | 376 | rc = register_reboot_notifier(&wdt_notifier); |
377 | if (rc) | 377 | if (rc) |
378 | { | 378 | { |
379 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 379 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", |
380 | wdt_miscdev.minor, rc); | 380 | rc); |
381 | goto err_out_region2; | 381 | goto err_out_region2; |
382 | } | 382 | } |
383 | 383 | ||
384 | rc = register_reboot_notifier(&wdt_notifier); | 384 | rc = misc_register(&wdt_miscdev); |
385 | if (rc) | 385 | if (rc) |
386 | { | 386 | { |
387 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", | 387 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", |
388 | rc); | 388 | wdt_miscdev.minor, rc); |
389 | goto err_out_miscdev; | 389 | goto err_out_reboot; |
390 | } | 390 | } |
391 | 391 | ||
392 | printk(KERN_INFO PFX "WDT driver for W83877F initialised. timeout=%d sec (nowayout=%d)\n", | 392 | printk(KERN_INFO PFX "WDT driver for W83877F initialised. timeout=%d sec (nowayout=%d)\n", |
@@ -394,8 +394,8 @@ static int __init w83877f_wdt_init(void) | |||
394 | 394 | ||
395 | return 0; | 395 | return 0; |
396 | 396 | ||
397 | err_out_miscdev: | 397 | err_out_reboot: |
398 | misc_deregister(&wdt_miscdev); | 398 | unregister_reboot_notifier(&wdt_notifier); |
399 | err_out_region2: | 399 | err_out_region2: |
400 | release_region(WDT_PING,1); | 400 | release_region(WDT_PING,1); |
401 | err_out_region1: | 401 | err_out_region1: |
diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c index b475529d2475..b209bcd7f789 100644 --- a/drivers/watchdog/w83977f_wdt.c +++ b/drivers/watchdog/w83977f_wdt.c | |||
@@ -494,20 +494,20 @@ static int __init w83977f_wdt_init(void) | |||
494 | goto err_out; | 494 | goto err_out; |
495 | } | 495 | } |
496 | 496 | ||
497 | rc = misc_register(&wdt_miscdev); | 497 | rc = register_reboot_notifier(&wdt_notifier); |
498 | if (rc) | 498 | if (rc) |
499 | { | 499 | { |
500 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 500 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", |
501 | wdt_miscdev.minor, rc); | 501 | rc); |
502 | goto err_out_region; | 502 | goto err_out_region; |
503 | } | 503 | } |
504 | 504 | ||
505 | rc = register_reboot_notifier(&wdt_notifier); | 505 | rc = misc_register(&wdt_miscdev); |
506 | if (rc) | 506 | if (rc) |
507 | { | 507 | { |
508 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", | 508 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", |
509 | rc); | 509 | wdt_miscdev.minor, rc); |
510 | goto err_out_miscdev; | 510 | goto err_out_reboot; |
511 | } | 511 | } |
512 | 512 | ||
513 | printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d testmode=%d)\n", | 513 | printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d testmode=%d)\n", |
@@ -515,8 +515,8 @@ static int __init w83977f_wdt_init(void) | |||
515 | 515 | ||
516 | return 0; | 516 | return 0; |
517 | 517 | ||
518 | err_out_miscdev: | 518 | err_out_reboot: |
519 | misc_deregister(&wdt_miscdev); | 519 | unregister_reboot_notifier(&wdt_notifier); |
520 | err_out_region: | 520 | err_out_region: |
521 | release_region(IO_INDEX_PORT,2); | 521 | release_region(IO_INDEX_PORT,2); |
522 | err_out: | 522 | err_out: |
diff --git a/drivers/watchdog/wdt977.c b/drivers/watchdog/wdt977.c index 9b7f6b6edef6..fb4b876c9fda 100644 --- a/drivers/watchdog/wdt977.c +++ b/drivers/watchdog/wdt977.c | |||
@@ -470,20 +470,20 @@ static int __init wd977_init(void) | |||
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
473 | rc = misc_register(&wdt977_miscdev); | 473 | rc = register_reboot_notifier(&wdt977_notifier); |
474 | if (rc) | 474 | if (rc) |
475 | { | 475 | { |
476 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 476 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", |
477 | wdt977_miscdev.minor, rc); | 477 | rc); |
478 | goto err_out_region; | 478 | goto err_out_region; |
479 | } | 479 | } |
480 | 480 | ||
481 | rc = register_reboot_notifier(&wdt977_notifier); | 481 | rc = misc_register(&wdt977_miscdev); |
482 | if (rc) | 482 | if (rc) |
483 | { | 483 | { |
484 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", | 484 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", |
485 | rc); | 485 | wdt977_miscdev.minor, rc); |
486 | goto err_out_miscdev; | 486 | goto err_out_reboot; |
487 | } | 487 | } |
488 | 488 | ||
489 | printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d, testmode=%i)\n", | 489 | printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d, testmode=%i)\n", |
@@ -491,8 +491,8 @@ static int __init wd977_init(void) | |||
491 | 491 | ||
492 | return 0; | 492 | return 0; |
493 | 493 | ||
494 | err_out_miscdev: | 494 | err_out_reboot: |
495 | misc_deregister(&wdt977_miscdev); | 495 | unregister_reboot_notifier(&wdt977_notifier); |
496 | err_out_region: | 496 | err_out_region: |
497 | if (!machine_is_netwinder()) | 497 | if (!machine_is_netwinder()) |
498 | release_region(IO_INDEX_PORT,2); | 498 | release_region(IO_INDEX_PORT,2); |