linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / char / watchdog / sc1200wdt.c
index df38161..787a915 100644 (file)
@@ -74,9 +74,9 @@ static char banner[] __initdata = KERN_INFO PFX SC1200_MODULE_VER;
 static int timeout = 1;
 static int io = -1;
 static int io_len = 2;         /* for non plug and play */
-struct semaphore open_sem;
+static struct semaphore open_sem;
 static char expect_close;
-spinlock_t sc1200wdt_lock;     /* io port access serialisation */
+static spinlock_t sc1200wdt_lock;      /* io port access serialisation */
 
 #if defined CONFIG_PNP
 static int isapnp = 1;
@@ -91,12 +91,7 @@ MODULE_PARM_DESC(io, "io port");
 module_param(timeout, int, 0);
 MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1");
 
-#ifdef CONFIG_WATCHDOG_NOWAYOUT
-static int nowayout = 1;
-#else
-static int nowayout = 0;
-#endif
-
+static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
 
@@ -157,6 +152,8 @@ 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;
@@ -258,9 +255,6 @@ static int sc1200wdt_release(struct inode *inode, struct file *file)
 
 static ssize_t sc1200wdt_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
 {
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (len) {
                if (!nowayout) {
                        size_t i;
@@ -302,6 +296,7 @@ static struct notifier_block sc1200wdt_notifier =
 static struct file_operations sc1200wdt_fops =
 {
        .owner          = THIS_MODULE,
+       .llseek         = no_llseek,
        .write          = sc1200wdt_write,
        .ioctl          = sc1200wdt_ioctl,
        .open           = sc1200wdt_open,
@@ -335,7 +330,7 @@ static int __init sc1200wdt_probe(void)
 
 #if defined CONFIG_PNP
 
-struct pnp_device_id scl200wdt_pnp_devices[] = {
+static struct pnp_device_id scl200wdt_pnp_devices[] = {
        /* National Semiconductor PC87307/PC97307 watchdog component */
        {.id = "NSC0800", .driver_data = 0},
        {.id = ""},
@@ -382,7 +377,7 @@ static int __init sc1200wdt_init(void)
 {
        int ret;
 
-       printk(banner);
+       printk("%s\n", banner);
 
        spin_lock_init(&sc1200wdt_lock);
        sema_init(&open_sem, 1);
@@ -398,7 +393,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
@@ -411,7 +406,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();
@@ -441,6 +436,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;
 }