ARM: 6124/1: ep93xx: SPI driver platform support code
[safe/jmp/linux-2.6] / drivers / watchdog / eurotechwdt.c
index b94e6ef..d1c4e55 100644 (file)
@@ -8,19 +8,19 @@
  *     Based on wdt.c.
  *     Original copyright messages:
  *
- *      (c) Copyright 1996-1997 Alan Cox <alan@redhat.com>, All Rights Reserved.
- *                              http://www.redhat.com
+ *     (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
+ *                                             All Rights Reserved.
  *
- *      This program is free software; you can redistribute it and/or
- *      modify it under the terms of the GNU General Public License
- *      as published by the Free Software Foundation; either version
- *      2 of the License, or (at your option) any later version.
+ *     This program is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License
+ *     as published by the Free Software Foundation; either version
+ *     2 of the License, or (at your option) any later version.
  *
- *      Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
- *      warranty for any of this software. This material is provided
- *      "AS-IS" and at no charge.
+ *     Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
+ *     warranty for any of this software. This material is provided
+ *     "AS-IS" and at no charge.
  *
- *      (c) Copyright 1995    Alan Cox <alan@lxorguk.ukuu.org.uk>*
+ *     (c) Copyright 1995    Alan Cox <alan@lxorguk.ukuu.org.uk>*
  */
 
 /* Changelog:
@@ -37,7 +37,7 @@
  *     add expect_close support
  *
  * 2002.05.30 - Joel Becker <joel.becker@oracle.com>
- *     Added Matt Domsch's nowayout module option.
+ *     Added Matt Domsch's nowayout module option.
  */
 
 /*
@@ -151,7 +151,7 @@ static void eurwdt_activate_timer(void)
        if (irq == 0)
                printk(KERN_INFO ": interrupt disabled\n");
 
-       eurwdt_write_reg(WDT_TIMER_CFG, irq<<4);
+       eurwdt_write_reg(WDT_TIMER_CFG, irq << 4);
 
        eurwdt_write_reg(WDT_UNIT_SEL, WDT_UNIT_SECS);  /* we use seconds */
        eurwdt_set_timeout(0);  /* the default timeout */
@@ -210,7 +210,7 @@ size_t count, loff_t *ppos)
 
                        for (i = 0; i != count; i++) {
                                char c;
-                               if (get_user(c, buf+i))
+                               if (get_user(c, buf + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        eur_expect_close = 42;
@@ -238,7 +238,7 @@ static long eurwdt_ioctl(struct file *file,
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
-       static struct watchdog_info ident = {
+       static const struct watchdog_info ident = {
                .options          = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
                                                        | WDIOF_MAGICCLOSE,
                .firmware_version = 1,
@@ -249,9 +249,6 @@ static long eurwdt_ioctl(struct file *file,
        int options, retval = -EINVAL;
 
        switch (cmd) {
-       default:
-               return -ENOTTY;
-
        case WDIOC_GETSUPPORT:
                return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
 
@@ -259,6 +256,22 @@ static long eurwdt_ioctl(struct file *file,
        case WDIOC_GETBOOTSTATUS:
                return put_user(0, p);
 
+       case WDIOC_SETOPTIONS:
+               if (get_user(options, p))
+                       return -EFAULT;
+               spin_lock(&eurwdt_lock);
+               if (options & WDIOS_DISABLECARD) {
+                       eurwdt_disable_timer();
+                       retval = 0;
+               }
+               if (options & WDIOS_ENABLECARD) {
+                       eurwdt_activate_timer();
+                       eurwdt_ping();
+                       retval = 0;
+               }
+               spin_unlock(&eurwdt_lock);
+               return retval;
+
        case WDIOC_KEEPALIVE:
                spin_lock(&eurwdt_lock);
                eurwdt_ping();
@@ -282,21 +295,8 @@ static long eurwdt_ioctl(struct file *file,
        case WDIOC_GETTIMEOUT:
                return put_user(eurwdt_timeout, p);
 
-       case WDIOC_SETOPTIONS:
-               if (get_user(options, p))
-                       return -EFAULT;
-               spin_lock(&eurwdt_lock);
-               if (options & WDIOS_DISABLECARD) {
-                       eurwdt_disable_timer();
-                       retval = 0;
-               }
-               if (options & WDIOS_ENABLECARD) {
-                       eurwdt_activate_timer();
-                       eurwdt_ping();
-                       retval = 0;
-               }
-               spin_unlock(&eurwdt_lock);
-               return retval;
+       default:
+               return -ENOTTY;
        }
 }
 
@@ -360,10 +360,8 @@ static int eurwdt_release(struct inode *inode, struct file *file)
 static int eurwdt_notify_sys(struct notifier_block *this, unsigned long code,
        void *unused)
 {
-       if (code == SYS_DOWN || code == SYS_HALT) {
-               /* Turn the card off */
-               eurwdt_disable_timer();
-       }
+       if (code == SYS_DOWN || code == SYS_HALT)
+               eurwdt_disable_timer(); /* Turn the card off */
 
        return NOTIFY_DONE;
 }