summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2007-01-27 21:58:08 +0100
committerWim Van Sebroeck <wim@iguana.be>2007-01-27 21:58:08 +0100
commitf6e4803969ee93bef6aeeb6aff0f9214547d1bb1 (patch)
tree826526af2f8e69035b19bd0d8fbd424d8033d9ab /drivers/char
parent35d55c943117864b9dff0253eb64672f048ac0f8 (diff)
downloadop-kernel-dev-f6e4803969ee93bef6aeeb6aff0f9214547d1bb1.zip
op-kernel-dev-f6e4803969ee93bef6aeeb6aff0f9214547d1bb1.tar.gz
[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.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c
index 5510db2..d379bf0 100644
--- a/drivers/char/watchdog/ib700wdt.c
+++ b/drivers/char/watchdog/ib700wdt.c
@@ -300,6 +300,10 @@ static struct notifier_block ibwdt_notifier = {
.notifier_call = ibwdt_notify_sys,
};
+/*
+ * Init & exit routines
+ */
+
static int __init ibwdt_init(void)
{
int res;
@@ -307,11 +311,6 @@ static int __init ibwdt_init(void)
printk(KERN_INFO PFX "WDT driver for IB700 single board computer initialising.\n");
spin_lock_init(&ibwdt_lock);
- res = misc_register(&ibwdt_miscdev);
- if (res) {
- printk (KERN_ERR PFX "failed to register misc device\n");
- goto out_nomisc;
- }
#if WDT_START != WDT_STOP
if (!request_region(WDT_STOP, 1, "IB700 WDT")) {
@@ -326,13 +325,22 @@ static int __init ibwdt_init(void)
res = -EIO;
goto out_nostartreg;
}
+
res = register_reboot_notifier(&ibwdt_notifier);
if (res) {
printk (KERN_ERR PFX "Failed to register reboot notifier.\n");
goto out_noreboot;
}
+
+ res = misc_register(&ibwdt_miscdev);
+ if (res) {
+ printk (KERN_ERR PFX "failed to register misc device\n");
+ goto out_nomisc;
+ }
return 0;
+out_nomisc:
+ unregister_reboot_notifier(&ibwdt_notifier);
out_noreboot:
release_region(WDT_START, 1);
out_nostartreg:
@@ -340,8 +348,6 @@ out_nostartreg:
release_region(WDT_STOP, 1);
#endif
out_nostopreg:
- misc_deregister(&ibwdt_miscdev);
-out_nomisc:
return res;
}
@@ -350,10 +356,10 @@ ibwdt_exit(void)
{
misc_deregister(&ibwdt_miscdev);
unregister_reboot_notifier(&ibwdt_notifier);
+ release_region(WDT_START,1);
#if WDT_START != WDT_STOP
release_region(WDT_STOP,1);
#endif
- release_region(WDT_START,1);
}
module_init(ibwdt_init);
OpenPOWER on IntegriCloud