aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/watchdog/sbc_epx_c3.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/char/watchdog/sbc_epx_c3.c b/drivers/char/watchdog/sbc_epx_c3.c
index 951764614ebf..7a4dfb95d087 100644
--- a/drivers/char/watchdog/sbc_epx_c3.c
+++ b/drivers/char/watchdog/sbc_epx_c3.c
@@ -25,6 +25,7 @@
25#include <linux/notifier.h> 25#include <linux/notifier.h>
26#include <linux/reboot.h> 26#include <linux/reboot.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/ioport.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/io.h> 30#include <asm/io.h>
30 31
@@ -181,11 +182,14 @@ static int __init watchdog_init(void)
181{ 182{
182 int ret; 183 int ret;
183 184
185 if (!request_region(EPXC3_WATCHDOG_CTL_REG, 2, "epxc3_watchdog"))
186 return -EBUSY;
187
184 ret = register_reboot_notifier(&epx_c3_notifier); 188 ret = register_reboot_notifier(&epx_c3_notifier);
185 if (ret) { 189 if (ret) {
186 printk(KERN_ERR PFX "cannot register reboot notifier " 190 printk(KERN_ERR PFX "cannot register reboot notifier "
187 "(err=%d)\n", ret); 191 "(err=%d)\n", ret);
188 return ret; 192 goto out;
189 } 193 }
190 194
191 ret = misc_register(&epx_c3_miscdev); 195 ret = misc_register(&epx_c3_miscdev);
@@ -193,18 +197,23 @@ static int __init watchdog_init(void)
193 printk(KERN_ERR PFX "cannot register miscdev on minor=%d " 197 printk(KERN_ERR PFX "cannot register miscdev on minor=%d "
194 "(err=%d)\n", WATCHDOG_MINOR, ret); 198 "(err=%d)\n", WATCHDOG_MINOR, ret);
195 unregister_reboot_notifier(&epx_c3_notifier); 199 unregister_reboot_notifier(&epx_c3_notifier);
196 return ret; 200 goto out;
197 } 201 }
198 202
199 printk(banner); 203 printk(banner);
200 204
201 return 0; 205 return 0;
206
207out:
208 release_region(EPXC3_WATCHDOG_CTL_REG, 2);
209 return ret;
202} 210}
203 211
204static void __exit watchdog_exit(void) 212static void __exit watchdog_exit(void)
205{ 213{
206 misc_deregister(&epx_c3_miscdev); 214 misc_deregister(&epx_c3_miscdev);
207 unregister_reboot_notifier(&epx_c3_notifier); 215 unregister_reboot_notifier(&epx_c3_notifier);
216 release_region(EPXC3_WATCHDOG_CTL_REG, 2);
208} 217}
209 218
210module_init(watchdog_init); 219module_init(watchdog_init);