diff options
author | Wim Van Sebroeck <wim@iguana.be> | 2007-01-27 15:58:08 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2007-01-27 15:58:08 -0500 |
commit | f6e4803969ee93bef6aeeb6aff0f9214547d1bb1 (patch) | |
tree | 826526af2f8e69035b19bd0d8fbd424d8033d9ab /drivers/char | |
parent | 35d55c943117864b9dff0253eb64672f048ac0f8 (diff) |
[WATCHDOG] ib700wdt.c clean-up init and exit routines
clean-up the init and exit routines so that they use
the same sequence.
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/watchdog/ib700wdt.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c index 5510db21090a..d379bf075264 100644 --- a/drivers/char/watchdog/ib700wdt.c +++ b/drivers/char/watchdog/ib700wdt.c | |||
@@ -300,6 +300,10 @@ static struct notifier_block ibwdt_notifier = { | |||
300 | .notifier_call = ibwdt_notify_sys, | 300 | .notifier_call = ibwdt_notify_sys, |
301 | }; | 301 | }; |
302 | 302 | ||
303 | /* | ||
304 | * Init & exit routines | ||
305 | */ | ||
306 | |||
303 | static int __init ibwdt_init(void) | 307 | static int __init ibwdt_init(void) |
304 | { | 308 | { |
305 | int res; | 309 | int res; |
@@ -307,11 +311,6 @@ static int __init ibwdt_init(void) | |||
307 | printk(KERN_INFO PFX "WDT driver for IB700 single board computer initialising.\n"); | 311 | printk(KERN_INFO PFX "WDT driver for IB700 single board computer initialising.\n"); |
308 | 312 | ||
309 | spin_lock_init(&ibwdt_lock); | 313 | spin_lock_init(&ibwdt_lock); |
310 | res = misc_register(&ibwdt_miscdev); | ||
311 | if (res) { | ||
312 | printk (KERN_ERR PFX "failed to register misc device\n"); | ||
313 | goto out_nomisc; | ||
314 | } | ||
315 | 314 | ||
316 | #if WDT_START != WDT_STOP | 315 | #if WDT_START != WDT_STOP |
317 | if (!request_region(WDT_STOP, 1, "IB700 WDT")) { | 316 | if (!request_region(WDT_STOP, 1, "IB700 WDT")) { |
@@ -326,13 +325,22 @@ static int __init ibwdt_init(void) | |||
326 | res = -EIO; | 325 | res = -EIO; |
327 | goto out_nostartreg; | 326 | goto out_nostartreg; |
328 | } | 327 | } |
328 | |||
329 | res = register_reboot_notifier(&ibwdt_notifier); | 329 | res = register_reboot_notifier(&ibwdt_notifier); |
330 | if (res) { | 330 | if (res) { |
331 | printk (KERN_ERR PFX "Failed to register reboot notifier.\n"); | 331 | printk (KERN_ERR PFX "Failed to register reboot notifier.\n"); |
332 | goto out_noreboot; | 332 | goto out_noreboot; |
333 | } | 333 | } |
334 | |||
335 | res = misc_register(&ibwdt_miscdev); | ||
336 | if (res) { | ||
337 | printk (KERN_ERR PFX "failed to register misc device\n"); | ||
338 | goto out_nomisc; | ||
339 | } | ||
334 | return 0; | 340 | return 0; |
335 | 341 | ||
342 | out_nomisc: | ||
343 | unregister_reboot_notifier(&ibwdt_notifier); | ||
336 | out_noreboot: | 344 | out_noreboot: |
337 | release_region(WDT_START, 1); | 345 | release_region(WDT_START, 1); |
338 | out_nostartreg: | 346 | out_nostartreg: |
@@ -340,8 +348,6 @@ out_nostartreg: | |||
340 | release_region(WDT_STOP, 1); | 348 | release_region(WDT_STOP, 1); |
341 | #endif | 349 | #endif |
342 | out_nostopreg: | 350 | out_nostopreg: |
343 | misc_deregister(&ibwdt_miscdev); | ||
344 | out_nomisc: | ||
345 | return res; | 351 | return res; |
346 | } | 352 | } |
347 | 353 | ||
@@ -350,10 +356,10 @@ ibwdt_exit(void) | |||
350 | { | 356 | { |
351 | misc_deregister(&ibwdt_miscdev); | 357 | misc_deregister(&ibwdt_miscdev); |
352 | unregister_reboot_notifier(&ibwdt_notifier); | 358 | unregister_reboot_notifier(&ibwdt_notifier); |
359 | release_region(WDT_START,1); | ||
353 | #if WDT_START != WDT_STOP | 360 | #if WDT_START != WDT_STOP |
354 | release_region(WDT_STOP,1); | 361 | release_region(WDT_STOP,1); |
355 | #endif | 362 | #endif |
356 | release_region(WDT_START,1); | ||
357 | } | 363 | } |
358 | 364 | ||
359 | module_init(ibwdt_init); | 365 | module_init(ibwdt_init); |