[WATCHDOG] Return value of nonseekable_open
[linux-2.6-block.git] / drivers / char / watchdog / sc1200wdt.c
index 7c3cf293a5afc3684111c95bce7ad52653a4cb74..9670d47190d0875a41a23b81d0dc568ab3e0cb4e 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/init.h>
 #include <linux/pnp.h>
 #include <linux/fs.h>
-#include <linux/pci.h>
 
 #include <asm/semaphore.h>
 #include <asm/io.h>
@@ -92,7 +91,7 @@ MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 
 
@@ -151,8 +150,6 @@ static inline int sc1200wdt_status(void)
 
 static int sc1200wdt_open(struct inode *inode, struct file *file)
 {
-       nonseekable_open(inode, file);
-
        /* allow one at a time */
        if (down_trylock(&open_sem))
                return -EBUSY;
@@ -163,7 +160,7 @@ static int sc1200wdt_open(struct inode *inode, struct file *file)
        sc1200wdt_start();
        printk(KERN_INFO PFX "Watchdog enabled, timeout = %d min(s)", timeout);
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 
@@ -180,7 +177,7 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
 
        switch (cmd) {
                default:
-                       return -ENOIOCTLCMD;    /* Keep Pavel Machek amused ;) */
+                       return -ENOTTY;
 
                case WDIOC_GETSUPPORT:
                        if (copy_to_user(argp, &ident, sizeof ident))
@@ -392,7 +389,7 @@ static int __init sc1200wdt_init(void)
        if (io == -1) {
                printk(KERN_ERR PFX "io parameter must be specified\n");
                ret = -EINVAL;
-               goto out_clean;
+               goto out_pnp;
        }
 
 #if defined CONFIG_PNP
@@ -405,7 +402,7 @@ static int __init sc1200wdt_init(void)
        if (!request_region(io, io_len, SC1200_MODULE_NAME)) {
                printk(KERN_ERR PFX "Unable to register IO port %#x\n", io);
                ret = -EBUSY;
-               goto out_clean;
+               goto out_pnp;
        }
 
        ret = sc1200wdt_probe();
@@ -435,6 +432,11 @@ out_rbt:
 out_io:
        release_region(io, io_len);
 
+out_pnp:
+#if defined CONFIG_PNP
+       if (isapnp)
+               pnp_unregister_driver(&scl200wdt_pnp_driver);
+#endif
        goto out_clean;
 }