]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge Linus' latest into master
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Fri, 8 Aug 2008 16:33:47 +0000 (17:33 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 8 Aug 2008 18:18:18 +0000 (19:18 +0100)
Conflicts:

drivers/watchdog/at91rm9200_wdt.c
drivers/watchdog/davinci_wdt.c
drivers/watchdog/ep93xx_wdt.c
drivers/watchdog/ixp2000_wdt.c
drivers/watchdog/ixp4xx_wdt.c
drivers/watchdog/ks8695_wdt.c
drivers/watchdog/omap_wdt.c
drivers/watchdog/pnx4008_wdt.c
drivers/watchdog/sa1100_wdt.c
drivers/watchdog/wdt285.c

13 files changed:
1  2 
drivers/media/video/pxa_camera.c
drivers/watchdog/at91rm9200_wdt.c
drivers/watchdog/davinci_wdt.c
drivers/watchdog/ep93xx_wdt.c
drivers/watchdog/iop_wdt.c
drivers/watchdog/ixp2000_wdt.c
drivers/watchdog/ixp4xx_wdt.c
drivers/watchdog/ks8695_wdt.c
drivers/watchdog/omap_wdt.c
drivers/watchdog/pnx4008_wdt.c
drivers/watchdog/s3c2410_wdt.c
drivers/watchdog/sa1100_wdt.c
drivers/watchdog/wdt285.c

index 5e7ebca1968e9263c12736b35fce89a2e2e27ddf,ead87ddaf7fbe4daed95c7896bf2f2d7cdbe6a4f..388cf94055d35e13311569fb29494ce949d0e0c2
@@@ -36,8 -36,8 +36,8 @@@
  #include <linux/videodev2.h>
  
  #include <asm/dma.h>
 -#include <asm/arch/pxa-regs.h>
 -#include <asm/arch/camera.h>
 +#include <mach/pxa-regs.h>
 +#include <mach/camera.h>
  
  #define PXA_CAM_VERSION_CODE KERNEL_VERSION(0, 0, 5)
  #define PXA_CAM_DRV_NAME "pxa27x-camera"
@@@ -128,6 -128,8 +128,8 @@@ struct pxa_camera_dev 
  
        struct pxa_buffer       *active;
        struct pxa_dma_desc     *sg_tail[3];
+       u32                     save_cicr[5];
  };
  
  static const char *pxa_cam_driver_description = "PXA_Camera";
@@@ -997,10 -999,64 +999,64 @@@ static int pxa_camera_querycap(struct s
        return 0;
  }
  
+ static int pxa_camera_suspend(struct soc_camera_device *icd, pm_message_t state)
+ {
+       struct soc_camera_host *ici =
+               to_soc_camera_host(icd->dev.parent);
+       struct pxa_camera_dev *pcdev = ici->priv;
+       int i = 0, ret = 0;
+       pcdev->save_cicr[i++] = CICR0;
+       pcdev->save_cicr[i++] = CICR1;
+       pcdev->save_cicr[i++] = CICR2;
+       pcdev->save_cicr[i++] = CICR3;
+       pcdev->save_cicr[i++] = CICR4;
+       if ((pcdev->icd) && (pcdev->icd->ops->suspend))
+               ret = pcdev->icd->ops->suspend(pcdev->icd, state);
+       return ret;
+ }
+ static int pxa_camera_resume(struct soc_camera_device *icd)
+ {
+       struct soc_camera_host *ici =
+               to_soc_camera_host(icd->dev.parent);
+       struct pxa_camera_dev *pcdev = ici->priv;
+       int i = 0, ret = 0;
+       DRCMR68 = pcdev->dma_chans[0] | DRCMR_MAPVLD;
+       DRCMR69 = pcdev->dma_chans[1] | DRCMR_MAPVLD;
+       DRCMR70 = pcdev->dma_chans[2] | DRCMR_MAPVLD;
+       CICR0 = pcdev->save_cicr[i++] & ~CICR0_ENB;
+       CICR1 = pcdev->save_cicr[i++];
+       CICR2 = pcdev->save_cicr[i++];
+       CICR3 = pcdev->save_cicr[i++];
+       CICR4 = pcdev->save_cicr[i++];
+       if ((pcdev->icd) && (pcdev->icd->ops->resume))
+               ret = pcdev->icd->ops->resume(pcdev->icd);
+       /* Restart frame capture if active buffer exists */
+       if (!ret && pcdev->active) {
+               /* Reset the FIFOs */
+               CIFR |= CIFR_RESET_F;
+               /* Enable End-Of-Frame Interrupt */
+               CICR0 &= ~CICR0_EOFM;
+               /* Restart the Capture Interface */
+               CICR0 |= CICR0_ENB;
+       }
+       return ret;
+ }
  static struct soc_camera_host_ops pxa_soc_camera_host_ops = {
        .owner          = THIS_MODULE,
        .add            = pxa_camera_add_device,
        .remove         = pxa_camera_remove_device,
+       .suspend        = pxa_camera_suspend,
+       .resume         = pxa_camera_resume,
        .set_fmt_cap    = pxa_camera_set_fmt_cap,
        .try_fmt_cap    = pxa_camera_try_fmt_cap,
        .init_videobuf  = pxa_camera_init_videobuf,
@@@ -1198,7 -1254,7 +1254,7 @@@ static int __devinit pxa_camera_init(vo
  
  static void __exit pxa_camera_exit(void)
  {
-       return platform_driver_unregister(&pxa_camera_driver);
+       platform_driver_unregister(&pxa_camera_driver);
  }
  
  module_init(pxa_camera_init);
index bf872aa2b9f3cd66aee23574f42a425b54d7d1f1,2313f44144f8dcb42f9cde5f4baf09138e410792..bacd867dd22e4c36e56353cff77d2401666eb370
  #include <linux/platform_device.h>
  #include <linux/types.h>
  #include <linux/watchdog.h>
- #include <asm/uaccess.h>
+ #include <linux/uaccess.h>
 -#include <asm/arch/at91_st.h>
 -
 +#include <mach/at91_st.h>
  
  #define WDT_DEFAULT_TIME      5       /* seconds */
  #define WDT_MAX_TIME          256     /* seconds */
  
@@@ -31,11 -31,14 +30,14 @@@ static int wdt_time = WDT_DEFAULT_TIME
  static int nowayout = WATCHDOG_NOWAYOUT;
  
  module_param(wdt_time, int, 0);
- MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")");
+ MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="
+                               __MODULE_STRING(WDT_DEFAULT_TIME) ")");
  
  #ifdef CONFIG_WATCHDOG_NOWAYOUT
  module_param(nowayout, int, 0);
- MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+ MODULE_PARM_DESC(nowayout,
+               "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
  #endif
  
  
@@@ -46,7 -49,7 +48,7 @@@ static unsigned long at91wdt_busy
  /*
   * Disable the watchdog.
   */
- static void inline at91_wdt_stop(void)
+ static inline void at91_wdt_stop(void)
  {
        at91_sys_write(AT91_ST_WDMR, AT91_ST_EXTEN);
  }
  /*
   * Enable and reset the watchdog.
   */
- static void inline at91_wdt_start(void)
+ static inline void at91_wdt_start(void)
  {
-       at91_sys_write(AT91_ST_WDMR, AT91_ST_EXTEN | AT91_ST_RSTEN | (((65536 * wdt_time) >> 8) & AT91_ST_WDV));
+       at91_sys_write(AT91_ST_WDMR, AT91_ST_EXTEN | AT91_ST_RSTEN |
+                               (((65536 * wdt_time) >> 8) & AT91_ST_WDV));
        at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
  }
  
  /*
   * Reload the watchdog timer.  (ie, pat the watchdog)
   */
- static void inline at91_wdt_reload(void)
+ static inline void at91_wdt_reload(void)
  {
        at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
  }
@@@ -89,8 -93,9 +92,9 @@@ static int at91_wdt_open(struct inode *
   */
  static int at91_wdt_close(struct inode *inode, struct file *file)
  {
+       /* Disable the watchdog when file is closed */
        if (!nowayout)
-               at91_wdt_stop();        /* Disable the watchdog when file is closed */
+               at91_wdt_stop();
  
        clear_bit(0, &at91wdt_busy);
        return 0;
@@@ -110,7 -115,8 +114,8 @@@ static int at91_wdt_settimeout(int new_
        if ((new_time <= 0) || (new_time > WDT_MAX_TIME))
                return -EINVAL;
  
-       /* Set new watchdog time. It will be used when at91_wdt_start() is called. */
+       /* Set new watchdog time. It will be used when
+          at91_wdt_start() is called. */
        wdt_time = new_time;
        return 0;
  }
@@@ -123,60 -129,52 +128,52 @@@ static struct watchdog_info at91_wdt_in
  /*
   * Handle commands from user-space.
   */
- static int at91_wdt_ioctl(struct inode *inode, struct file *file,
-               unsigned int cmd, unsigned long arg)
+ static long at91_wdt_ioct(struct file *file,
+                                       unsigned int cmd, unsigned long arg)
  {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        int new_value;
  
-       switch(cmd) {
-               case WDIOC_KEEPALIVE:
-                       at91_wdt_reload();      /* pat the watchdog */
-                       return 0;
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &at91_wdt_info, sizeof(at91_wdt_info)) ? -EFAULT : 0;
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_value, p))
-                               return -EFAULT;
-                       if (at91_wdt_settimeout(new_value))
-                               return -EINVAL;
-                       /* Enable new time value */
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &at91_wdt_info,
+                               sizeof(at91_wdt_info)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_SETOPTIONS:
+               if (get_user(new_value, p))
+                       return -EFAULT;
+               if (new_value & WDIOS_DISABLECARD)
+                       at91_wdt_stop();
+               if (new_value & WDIOS_ENABLECARD)
                        at91_wdt_start();
-                       /* Return current value */
-                       return put_user(wdt_time, p);
-               case WDIOC_GETTIMEOUT:
-                       return put_user(wdt_time, p);
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-               case WDIOC_SETOPTIONS:
-                       if (get_user(new_value, p))
-                               return -EFAULT;
-                       if (new_value & WDIOS_DISABLECARD)
-                               at91_wdt_stop();
-                       if (new_value & WDIOS_ENABLECARD)
-                               at91_wdt_start();
-                       return 0;
-               default:
-                       return -ENOTTY;
+               return 0;
+       case WDIOC_KEEPALIVE:
+               at91_wdt_reload();      /* pat the watchdog */
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_value, p))
+                       return -EFAULT;
+               if (at91_wdt_settimeout(new_value))
+                       return -EINVAL;
+               /* Enable new time value */
+               at91_wdt_start();
+               /* Return current value */
+               return put_user(wdt_time, p);
+       case WDIOC_GETTIMEOUT:
+               return put_user(wdt_time, p);
+       default:
+               return -ENOTTY;
        }
  }
  
  /*
   * Pat the watchdog whenever device is written to.
   */
- static ssize_t at91_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+ static ssize_t at91_wdt_write(struct file *file, const char *data,
+                                               size_t len, loff_t *ppos)
  {
        at91_wdt_reload();              /* pat the watchdog */
        return len;
  static const struct file_operations at91wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
-       .ioctl          = at91_wdt_ioctl,
+       .unlocked_ioctl = at91_wdt_ioctl,
        .open           = at91_wdt_open,
        .release        = at91_wdt_close,
        .write          = at91_wdt_write,
@@@ -211,7 -209,8 +208,8 @@@ static int __init at91wdt_probe(struct 
        if (res)
                return res;
  
-       printk("AT91 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : "");
+       printk(KERN_INFO "AT91 Watchdog Timer enabled (%d seconds%s)\n",
+                               wdt_time, nowayout ? ", nowayout" : "");
        return 0;
  }
  
@@@ -265,7 -264,8 +263,8 @@@ static struct platform_driver at91wdt_d
  
  static int __init at91_wdt_init(void)
  {
-       /* Check that the heartbeat value is within range; if not reset to the default */
+       /* Check that the heartbeat value is within range;
+          if not reset to the default */
        if (at91_wdt_settimeout(wdt_time)) {
                at91_wdt_settimeout(WDT_DEFAULT_TIME);
                pr_info("at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time);
index 003dffe5cb19b6e0f9031cd6de420fa705ac7d30,802aeba347a062321233abcfa936c219dcd4c4d6..2e1360286732c8e3ca10ea93c25721e4ead43560
  #include <linux/bitops.h>
  #include <linux/platform_device.h>
  #include <linux/spinlock.h>
+ #include <linux/uaccess.h>
+ #include <linux/io.h>
 -
 -#include <asm/hardware.h>
 +#include <mach/hardware.h>
- #include <asm/uaccess.h>
- #include <asm/io.h>
  
  #define MODULE_NAME "DAVINCI-WDT: "
  
@@@ -143,9 -143,8 +142,8 @@@ static struct watchdog_info ident = 
        .identity = "DaVinci Watchdog",
  };
  
- static int
- davinci_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                 unsigned long arg)
+ static long davinci_wdt_ioctl(struct file *file,
+                                       unsigned int cmd, unsigned long arg)
  {
        int ret = -ENOTTY;
  
                ret = put_user(0, (int *)arg);
                break;
  
-       case WDIOC_GETTIMEOUT:
-               ret = put_user(heartbeat, (int *)arg);
-               break;
        case WDIOC_KEEPALIVE:
                wdt_service();
                ret = 0;
                break;
+       case WDIOC_GETTIMEOUT:
+               ret = put_user(heartbeat, (int *)arg);
+               break;
        }
        return ret;
  }
@@@ -184,7 -183,7 +182,7 @@@ static const struct file_operations dav
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .write = davinci_wdt_write,
-       .ioctl = davinci_wdt_ioctl,
+       .unlocked_ioctl = davinci_wdt_ioctl,
        .open = davinci_wdt_open,
        .release = davinci_wdt_release,
  };
index af8ef14c0e4ce784078b61f7766d4ca7beaff390,07b74a768922b8e2a5a7619d283aa37fbf558997..e9f950ff86eaee3e685bd35b4eb9c17221da4cde
@@@ -28,9 -28,9 +28,8 @@@
  #include <linux/miscdevice.h>
  #include <linux/watchdog.h>
  #include <linux/timer.h>
+ #include <linux/uaccess.h>
 -
 -#include <asm/hardware.h>
 +#include <mach/hardware.h>
- #include <asm/uaccess.h>
  
  #define WDT_VERSION   "0.3"
  #define PFX           "ep93xx_wdt: "
@@@ -136,9 -136,8 +135,8 @@@ static struct watchdog_info ident = 
        .identity = "EP93xx Watchdog",
  };
  
- static int
- ep93xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                unsigned long arg)
+ static long ep93xx_wdt_ioctl(struct file *file,
+                                       unsigned int cmd, unsigned long arg)
  {
        int ret = -ENOTTY;
  
                ret = put_user(boot_status, (int __user *)arg);
                break;
  
-       case WDIOC_GETTIMEOUT:
-               /* actually, it is 0.250 seconds.... */
-               ret = put_user(1, (int __user *)arg);
-               break;
        case WDIOC_KEEPALIVE:
                wdt_keepalive();
                ret = 0;
                break;
+       case WDIOC_GETTIMEOUT:
+               /* actually, it is 0.250 seconds.... */
+               ret = put_user(1, (int __user *)arg);
+               break;
        }
        return ret;
  }
@@@ -174,8 -173,8 +172,8 @@@ static int ep93xx_wdt_release(struct in
        if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
                wdt_shutdown();
        else
-               printk(KERN_CRIT PFX "Device closed unexpectedly - "
-                       "timer will not stop\n");
+               printk(KERN_CRIT PFX
+                       "Device closed unexpectedly - timer will not stop\n");
  
        clear_bit(WDT_IN_USE, &wdt_status);
        clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
  static const struct file_operations ep93xx_wdt_fops = {
        .owner          = THIS_MODULE,
        .write          = ep93xx_wdt_write,
-       .ioctl          = ep93xx_wdt_ioctl,
+       .unlocked_ioctl = ep93xx_wdt_ioctl,
        .open           = ep93xx_wdt_open,
        .release        = ep93xx_wdt_release,
  };
@@@ -243,7 -242,9 +241,9 @@@ module_param(nowayout, int, 0)
  MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
  
  module_param(timeout, int, 0);
- MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+ MODULE_PARM_DESC(timeout,
+       "Watchdog timeout in seconds. (1<=timeout<=3600, default="
+                               __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
  
  MODULE_AUTHOR("Ray Lehtiniemi <rayl@mail.com>,"
                "Alessandro Zummo <a.zummo@towertech.it>");
index 1946dd06d815c858d9189b2975314c067f419bb8,8278b13f77c79eb920956d9520389625147680fa..96eb2cbe5874dd887ba9ec072cdba9031fd2244c
  #include <linux/miscdevice.h>
  #include <linux/watchdog.h>
  #include <linux/uaccess.h>
 -#include <asm/hardware.h>
 +#include <mach/hardware.h>
  
  static int nowayout = WATCHDOG_NOWAYOUT;
  static unsigned long wdt_status;
  static unsigned long boot_status;
+ static spinlock_t wdt_lock;
  
  #define WDT_IN_USE            0
  #define WDT_OK_TO_CLOSE               1
@@@ -68,8 -69,10 +69,10 @@@ static void wdt_enable(void
        /* Arm and enable the Timer to starting counting down from 0xFFFF.FFFF
         * Takes approx. 10.7s to timeout
         */
+       spin_lock(&wdt_lock);
        write_wdtcr(IOP_WDTCR_EN_ARM);
        write_wdtcr(IOP_WDTCR_EN);
+       spin_unlock(&wdt_lock);
  }
  
  /* returns 0 if the timer was successfully disabled */
@@@ -77,9 -80,11 +80,11 @@@ static int wdt_disable(void
  {
        /* Stop Counting */
        if (wdt_supports_disable()) {
+               spin_lock(&wdt_lock);
                write_wdtcr(IOP_WDTCR_DIS_ARM);
                write_wdtcr(IOP_WDTCR_DIS);
                clear_bit(WDT_ENABLED, &wdt_status);
+               spin_unlock(&wdt_lock);
                printk(KERN_INFO "WATCHDOG: Disabled\n");
                return 0;
        } else
@@@ -92,16 -97,12 +97,12 @@@ static int iop_wdt_open(struct inode *i
                return -EBUSY;
  
        clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
        wdt_enable();
        set_bit(WDT_ENABLED, &wdt_status);
        return nonseekable_open(inode, file);
  }
  
- static ssize_t
- iop_wdt_write(struct file *file, const char *data, size_t len,
+ static ssize_t iop_wdt_write(struct file *file, const char *data, size_t len,
                  loff_t *ppos)
  {
        if (len) {
                }
                wdt_enable();
        }
        return len;
  }
  
- static struct watchdog_info ident = {
+ static const struct watchdog_info ident = {
        .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING,
        .identity = "iop watchdog",
  };
  
- static int
- iop_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                 unsigned long arg)
+ static long iop_wdt_ioctl(struct file *file,
+                               unsigned int cmd, unsigned long arg)
  {
        int options;
        int ret = -ENOTTY;
+       int __user *argp = (int __user *)arg;
  
        switch (cmd) {
        case WDIOC_GETSUPPORT:
-               if (copy_to_user
-                   ((struct watchdog_info *)arg, &ident, sizeof ident))
+               if (copy_to_user(argp, &ident, sizeof ident))
                        ret = -EFAULT;
                else
                        ret = 0;
                break;
  
        case WDIOC_GETSTATUS:
-               ret = put_user(0, (int *)arg);
+               ret = put_user(0, argp);
                break;
  
        case WDIOC_GETBOOTSTATUS:
-               ret = put_user(boot_status, (int *)arg);
-               break;
-       case WDIOC_GETTIMEOUT:
-               ret = put_user(iop_watchdog_timeout(), (int *)arg);
-               break;
-       case WDIOC_KEEPALIVE:
-               wdt_enable();
-               ret = 0;
+               ret = put_user(boot_status, argp);
                break;
  
        case WDIOC_SETOPTIONS:
                        } else
                                ret = 0;
                }
                if (options & WDIOS_ENABLECARD) {
                        wdt_enable();
                        ret = 0;
                }
                break;
-       }
  
+       case WDIOC_KEEPALIVE:
+               wdt_enable();
+               ret = 0;
+               break;
+       case WDIOC_GETTIMEOUT:
+               ret = put_user(iop_watchdog_timeout(), argp);
+               break;
+       }
        return ret;
  }
  
@@@ -214,7 -211,7 +211,7 @@@ static const struct file_operations iop
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .write = iop_wdt_write,
-       .ioctl = iop_wdt_ioctl,
+       .unlocked_ioctl = iop_wdt_ioctl,
        .open = iop_wdt_open,
        .release = iop_wdt_release,
  };
@@@ -229,10 -226,8 +226,8 @@@ static int __init iop_wdt_init(void
  {
        int ret;
  
-       ret = misc_register(&iop_wdt_miscdev);
-       if (ret == 0)
-               printk("iop watchdog timer: timeout %lu sec\n",
-                      iop_watchdog_timeout());
+       spin_lock_init(&wdt_lock);
  
        /* check if the reset was caused by the watchdog timer */
        boot_status = (read_rcsr() & IOP_RCSR_WDT) ? WDIOF_CARDRESET : 0;
         */
        write_wdtsr(IOP13XX_WDTCR_IB_RESET);
  
+       /* Register after we have the device set up so we cannot race
+          with an open */
+       ret = misc_register(&iop_wdt_miscdev);
+       if (ret == 0)
+               printk(KERN_INFO "iop watchdog timer: timeout %lu sec\n",
+                      iop_watchdog_timeout());
        return ret;
  }
  
index 4226dae7d26016877ea9167675093ac4d66f9552,a77f69d528779663710b07f4d89f53271a688056..4f4b35a20d84ed6642fb789b49e6c601b8742d86
  #include <linux/watchdog.h>
  #include <linux/init.h>
  #include <linux/bitops.h>
+ #include <linux/uaccess.h>
 -
 -#include <asm/hardware.h>
 +#include <mach/hardware.h>
- #include <asm/uaccess.h>
  
  static int nowayout = WATCHDOG_NOWAYOUT;
  static unsigned int heartbeat = 60;   /* (secs) Default is 1 minute */
  static unsigned long wdt_status;
+ static spinlock_t wdt_lock;
  
  #define       WDT_IN_USE              0
  #define       WDT_OK_TO_CLOSE         1
  
  static unsigned long wdt_tick_rate;
  
- static void
- wdt_enable(void)
+ static void wdt_enable(void)
  {
+       spin_lock(&wdt_lock);
        ixp2000_reg_write(IXP2000_RESET0, *(IXP2000_RESET0) | WDT_RESET_ENABLE);
        ixp2000_reg_write(IXP2000_TWDE, WDT_ENABLE);
        ixp2000_reg_write(IXP2000_T4_CLD, heartbeat * wdt_tick_rate);
        ixp2000_reg_write(IXP2000_T4_CTL, TIMER_DIVIDER_256 | TIMER_ENABLE);
+       spin_unlock(&wdt_lock);
  }
  
- static void
- wdt_disable(void)
+ static void wdt_disable(void)
  {
+       spin_lock(&wdt_lock);
        ixp2000_reg_write(IXP2000_T4_CTL, 0);
+       spin_unlock(&wdt_lock);
  }
  
- static void
- wdt_keepalive(void)
+ static void wdt_keepalive(void)
  {
+       spin_lock(&wdt_lock);
        ixp2000_reg_write(IXP2000_T4_CLD, heartbeat * wdt_tick_rate);
+       spin_unlock(&wdt_lock);
  }
  
- static int
- ixp2000_wdt_open(struct inode *inode, struct file *file)
+ static int ixp2000_wdt_open(struct inode *inode, struct file *file)
  {
        if (test_and_set_bit(WDT_IN_USE, &wdt_status))
                return -EBUSY;
@@@ -72,8 -75,8 +74,8 @@@
        return nonseekable_open(inode, file);
  }
  
- static ssize_t
ixp2000_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+ static ssize_t ixp2000_wdt_write(struct file *file, const char *data,
                                              size_t len, loff_t *ppos)
  {
        if (len) {
                if (!nowayout) {
@@@ -103,9 -106,8 +105,8 @@@ static struct watchdog_info ident = 
        .identity       = "IXP2000 Watchdog",
  };
  
- static int
- ixp2000_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                       unsigned long arg)
+ static long ixp2000_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
  {
        int ret = -ENOTTY;
        int time;
                ret = put_user(0, (int *)arg);
                break;
  
+       case WDIOC_KEEPALIVE:
+               wdt_enable();
+               ret = 0;
+               break;
        case WDIOC_SETTIMEOUT:
                ret = get_user(time, (int *)arg);
                if (ret)
        case WDIOC_GETTIMEOUT:
                ret = put_user(heartbeat, (int *)arg);
                break;
-       case WDIOC_KEEPALIVE:
-               wdt_enable();
-               ret = 0;
-               break;
        }
  
        return ret;
  }
  
- static int
- ixp2000_wdt_release(struct inode *inode, struct file *file)
+ static int ixp2000_wdt_release(struct inode *inode, struct file *file)
  {
-       if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) {
+       if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
                wdt_disable();
-       } else {
+       else
                printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - "
                                        "timer will not stop\n");
-       }
        clear_bit(WDT_IN_USE, &wdt_status);
        clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
  
  }
  
  
- static const struct file_operations ixp2000_wdt_fops =
- {
+ static const struct file_operations ixp2000_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = ixp2000_wdt_write,
-       .ioctl          = ixp2000_wdt_ioctl,
+       .unlocked_ioctl = ixp2000_wdt_ioctl,
        .open           = ixp2000_wdt_open,
        .release        = ixp2000_wdt_release,
  };
  
- static struct miscdevice ixp2000_wdt_miscdev =
- {
+ static struct miscdevice ixp2000_wdt_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
        .fops           = &ixp2000_wdt_fops,
@@@ -191,9 -188,8 +187,8 @@@ static int __init ixp2000_wdt_init(void
                printk(KERN_INFO "Unable to use IXP2000 watchdog due to IXP2800 erratum #25.\n");
                return -EIO;
        }
        wdt_tick_rate = (*IXP2000_T1_CLD * HZ) / 256;
+       spin_lock_init(&wdt_lock);
        return misc_register(&ixp2000_wdt_miscdev);
  }
  
index 2313fad0dbb11091f9aee5557aa587e1d7ae0c81,ef3157dc9ac1349329563027df8fe21a0f894ba2..41264a5f173121c836f73a7ac4d778ff109c2a86
  #include <linux/watchdog.h>
  #include <linux/init.h>
  #include <linux/bitops.h>
+ #include <linux/uaccess.h>
 -
 -#include <asm/hardware.h>
 +#include <mach/hardware.h>
- #include <asm/uaccess.h>
  
  static int nowayout = WATCHDOG_NOWAYOUT;
  static int heartbeat = 60;    /* (secs) Default is 1 minute */
  static unsigned long wdt_status;
  static unsigned long boot_status;
+ static spin_lock_t wdt_lock;
  
  #define WDT_TICK_RATE (IXP4XX_PERIPHERAL_BUS_CLOCK * 1000000UL)
  
  #define       WDT_IN_USE              0
  #define       WDT_OK_TO_CLOSE         1
  
- static void
- wdt_enable(void)
+ static void wdt_enable(void)
  {
+       spin_lock(&wdt_lock);
        *IXP4XX_OSWK = IXP4XX_WDT_KEY;
        *IXP4XX_OSWE = 0;
        *IXP4XX_OSWT = WDT_TICK_RATE * heartbeat;
        *IXP4XX_OSWE = IXP4XX_WDT_COUNT_ENABLE | IXP4XX_WDT_RESET_ENABLE;
        *IXP4XX_OSWK = 0;
+       spin_unlock(&wdt_lock);
  }
  
- static void
- wdt_disable(void)
+ static void wdt_disable(void)
  {
+       spin_lock(&wdt_lock);
        *IXP4XX_OSWK = IXP4XX_WDT_KEY;
        *IXP4XX_OSWE = 0;
        *IXP4XX_OSWK = 0;
+       spin_unlock(&wdt_lock);
  }
  
- static int
- ixp4xx_wdt_open(struct inode *inode, struct file *file)
+ static int ixp4xx_wdt_open(struct inode *inode, struct file *file)
  {
        if (test_and_set_bit(WDT_IN_USE, &wdt_status))
                return -EBUSY;
  
        clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
        wdt_enable();
        return nonseekable_open(inode, file);
  }
  
@@@ -87,7 -87,6 +86,6 @@@ ixp4xx_wdt_write(struct file *file, con
                }
                wdt_enable();
        }
        return len;
  }
  
@@@ -98,9 -97,8 +96,8 @@@ static struct watchdog_info ident = 
  };
  
  
- static int
- ixp4xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                       unsigned long arg)
+ static long ixp4xx_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
  {
        int ret = -ENOTTY;
        int time;
                ret = put_user(boot_status, (int *)arg);
                break;
  
+       case WDIOC_KEEPALIVE:
+               wdt_enable();
+               ret = 0;
+               break;
        case WDIOC_SETTIMEOUT:
                ret = get_user(time, (int *)arg);
                if (ret)
        case WDIOC_GETTIMEOUT:
                ret = put_user(heartbeat, (int *)arg);
                break;
-       case WDIOC_KEEPALIVE:
-               wdt_enable();
-               ret = 0;
-               break;
        }
        return ret;
  }
  
- static int
- ixp4xx_wdt_release(struct inode *inode, struct file *file)
+ static int ixp4xx_wdt_release(struct inode *inode, struct file *file)
  {
-       if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) {
+       if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
                wdt_disable();
-       } else {
+       else
                printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - "
                                        "timer will not stop\n");
-       }
        clear_bit(WDT_IN_USE, &wdt_status);
        clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
  
  }
  
  
- static const struct file_operations ixp4xx_wdt_fops =
- {
+ static const struct file_operations ixp4xx_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = ixp4xx_wdt_write,
-       .ioctl          = ixp4xx_wdt_ioctl,
+       .unlocked_ioctl = ixp4xx_wdt_ioctl,
        .open           = ixp4xx_wdt_open,
        .release        = ixp4xx_wdt_release,
  };
  
- static struct miscdevice ixp4xx_wdt_miscdev =
- {
+ static struct miscdevice ixp4xx_wdt_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
        .fops           = &ixp4xx_wdt_fops,
@@@ -186,19 -179,18 +178,18 @@@ static int __init ixp4xx_wdt_init(void
  
        asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :);
        if (!(processor_id & 0xf) && !cpu_is_ixp46x()) {
-               printk("IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected - "
-                       "watchdog disabled\n");
+               printk(KERN_ERR "IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected"
+                       " - watchdog disabled\n");
  
                return -ENODEV;
        }
-       ret = misc_register(&ixp4xx_wdt_miscdev);
-       if (ret == 0)
-               printk("IXP4xx Watchdog Timer: heartbeat %d sec\n", heartbeat);
+       spin_lock_init(&wdt_lock);
        boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ?
                        WDIOF_CARDRESET : 0;
+       ret = misc_register(&ixp4xx_wdt_miscdev);
+       if (ret == 0)
+               printk(KERN_INFO "IXP4xx Watchdog Timer: heartbeat %d sec\n",
+                       heartbeat);
        return ret;
  }
  
index d21a6407fe2136d0dc42dc7173d0e8142c461384,f8566d5c62fe71da13fb20961d59d160d9219569..0b798fdaa378eccd53e39c5ab1fa538e19388b03
  #include <linux/platform_device.h>
  #include <linux/types.h>
  #include <linux/watchdog.h>
- #include <asm/io.h>
- #include <asm/uaccess.h>
+ #include <linux/io.h>
+ #include <linux/uaccess.h>
 -#include <asm/arch/regs-timer.h>
 -
 +#include <mach/regs-timer.h>
  
  #define WDT_DEFAULT_TIME      5       /* seconds */
  #define WDT_MAX_TIME          171     /* seconds */
  
@@@ -31,38 -31,44 +30,44 @@@ static int wdt_time = WDT_DEFAULT_TIME
  static int nowayout = WATCHDOG_NOWAYOUT;
  
  module_param(wdt_time, int, 0);
- MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")");
+ MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="
+                                       __MODULE_STRING(WDT_DEFAULT_TIME) ")");
  
  #ifdef CONFIG_WATCHDOG_NOWAYOUT
  module_param(nowayout, int, 0);
- MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
+                               __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
  #endif
  
  
  static unsigned long ks8695wdt_busy;
+ static spinlock_t ks8695_lock;
  
  /* ......................................................................... */
  
  /*
   * Disable the watchdog.
   */
- static void inline ks8695_wdt_stop(void)
+ static inline void ks8695_wdt_stop(void)
  {
        unsigned long tmcon;
  
+       spin_lock(&ks8695_lock);
        /* disable timer0 */
        tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
        __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
+       spin_unlock(&ks8695_lock);
  }
  
  /*
   * Enable and reset the watchdog.
   */
- static void inline ks8695_wdt_start(void)
+ static inline void ks8695_wdt_start(void)
  {
        unsigned long tmcon;
        unsigned long tval = wdt_time * CLOCK_TICK_RATE;
  
+       spin_lock(&ks8695_lock);
        /* disable timer0 */
        tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
        __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
        /* re-enable timer0 */
        tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
        __raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
+       spin_unlock(&ks8695_lock);
  }
  
  /*
   * Reload the watchdog timer.  (ie, pat the watchdog)
   */
- static void inline ks8695_wdt_reload(void)
+ static inline void ks8695_wdt_reload(void)
  {
        unsigned long tmcon;
  
+       spin_lock(&ks8695_lock);
        /* disable, then re-enable timer0 */
        tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
        __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
        __raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
+       spin_unlock(&ks8695_lock);
  }
  
  /*
@@@ -102,7 -111,8 +110,8 @@@ static int ks8695_wdt_settimeout(int ne
        if ((new_time <= 0) || (new_time > WDT_MAX_TIME))
                return -EINVAL;
  
-       /* Set new watchdog time. It will be used when ks8695_wdt_start() is called. */
+       /* Set new watchdog time. It will be used when
+          ks8695_wdt_start() is called. */
        wdt_time = new_time;
        return 0;
  }
@@@ -128,9 -138,9 +137,9 @@@ static int ks8695_wdt_open(struct inod
   */
  static int ks8695_wdt_close(struct inode *inode, struct file *file)
  {
+       /* Disable the watchdog when file is closed */
        if (!nowayout)
-               ks8695_wdt_stop();      /* Disable the watchdog when file is closed */
+               ks8695_wdt_stop();
        clear_bit(0, &ks8695wdt_busy);
        return 0;
  }
@@@ -143,60 -153,52 +152,52 @@@ static struct watchdog_info ks8695_wdt_
  /*
   * Handle commands from user-space.
   */
- static int ks8695_wdt_ioctl(struct inode *inode, struct file *file,
-               unsigned int cmd, unsigned long arg)
+ static long ks8695_wdt_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
  {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
        int new_value;
  
-       switch(cmd) {
-               case WDIOC_KEEPALIVE:
-                       ks8695_wdt_reload();    /* pat the watchdog */
-                       return 0;
-               case WDIOC_GETSUPPORT:
-                       return copy_to_user(argp, &ks8695_wdt_info, sizeof(ks8695_wdt_info)) ? -EFAULT : 0;
-               case WDIOC_SETTIMEOUT:
-                       if (get_user(new_value, p))
-                               return -EFAULT;
-                       if (ks8695_wdt_settimeout(new_value))
-                               return -EINVAL;
-                       /* Enable new time value */
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               return copy_to_user(argp, &ks8695_wdt_info,
+                                       sizeof(ks8695_wdt_info)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
+       case WDIOC_SETOPTIONS:
+               if (get_user(new_value, p))
+                       return -EFAULT;
+               if (new_value & WDIOS_DISABLECARD)
+                       ks8695_wdt_stop();
+               if (new_value & WDIOS_ENABLECARD)
                        ks8695_wdt_start();
-                       /* Return current value */
-                       return put_user(wdt_time, p);
-               case WDIOC_GETTIMEOUT:
-                       return put_user(wdt_time, p);
-               case WDIOC_GETSTATUS:
-               case WDIOC_GETBOOTSTATUS:
-                       return put_user(0, p);
-               case WDIOC_SETOPTIONS:
-                       if (get_user(new_value, p))
-                               return -EFAULT;
-                       if (new_value & WDIOS_DISABLECARD)
-                               ks8695_wdt_stop();
-                       if (new_value & WDIOS_ENABLECARD)
-                               ks8695_wdt_start();
-                       return 0;
-               default:
-                       return -ENOTTY;
+               return 0;
+       case WDIOC_KEEPALIVE:
+               ks8695_wdt_reload();    /* pat the watchdog */
+               return 0;
+       case WDIOC_SETTIMEOUT:
+               if (get_user(new_value, p))
+                       return -EFAULT;
+               if (ks8695_wdt_settimeout(new_value))
+                       return -EINVAL;
+               /* Enable new time value */
+               ks8695_wdt_start();
+               /* Return current value */
+               return put_user(wdt_time, p);
+       case WDIOC_GETTIMEOUT:
+               return put_user(wdt_time, p);
+       default:
+               return -ENOTTY;
        }
  }
  
  /*
   * Pat the watchdog whenever device is written to.
   */
- static ssize_t ks8695_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+ static ssize_t ks8695_wdt_write(struct file *file, const char *data,
+                                               size_t len, loff_t *ppos)
  {
        ks8695_wdt_reload();            /* pat the watchdog */
        return len;
  static const struct file_operations ks8695wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
-       .ioctl          = ks8695_wdt_ioctl,
+       .unlocked_ioctl = ks8695_wdt_ioctl,
        .open           = ks8695_wdt_open,
        .release        = ks8695_wdt_close,
        .write          = ks8695_wdt_write,
@@@ -231,7 -233,8 +232,8 @@@ static int __init ks8695wdt_probe(struc
        if (res)
                return res;
  
-       printk("KS8695 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : "");
+       printk(KERN_INFO "KS8695 Watchdog Timer enabled (%d seconds%s)\n",
+                               wdt_time, nowayout ? ", nowayout" : "");
        return 0;
  }
  
@@@ -285,12 -288,14 +287,14 @@@ static struct platform_driver ks8695wdt
  
  static int __init ks8695_wdt_init(void)
  {
-       /* Check that the heartbeat value is within range; if not reset to the default */
+       spin_lock_init(&ks8695_lock);
+       /* Check that the heartbeat value is within range;
+          if not reset to the default */
        if (ks8695_wdt_settimeout(wdt_time)) {
                ks8695_wdt_settimeout(WDT_DEFAULT_TIME);
-               pr_info("ks8695_wdt: wdt_time value must be 1 <= wdt_time <= %i, using %d\n", wdt_time, WDT_MAX_TIME);
+               pr_info("ks8695_wdt: wdt_time value must be 1 <= wdt_time <= %i, using %d\n",
+                                                       wdt_time, WDT_MAX_TIME);
        }
        return platform_driver_register(&ks8695wdt_driver);
  }
  
index 74a10d50607bd557acfacbbdcfb65e23d9e2e06d,6f5420f478a989b9fbd1ffd74415956a1c5e087c..3a11dadfd8e7dba34103f9d9b8685648e14a6f31
  #include <linux/moduleparam.h>
  #include <linux/clk.h>
  #include <linux/bitops.h>
- #include <asm/io.h>
- #include <asm/uaccess.h>
+ #include <linux/io.h>
+ #include <linux/uaccess.h>
 -#include <linux/hardware.h>
 -
 -#include <asm/arch/prcm.h>
 +#include <mach/hardware.h>
 +#include <mach/prcm.h>
  
  #include "omap_wdt.h"
  
@@@ -54,11 -53,12 +52,12 @@@ module_param(timer_margin, uint, 0)
  MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
  
  static int omap_wdt_users;
- static struct clk *armwdt_ck = NULL;
- static struct clk *mpu_wdt_ick = NULL;
- static struct clk *mpu_wdt_fck = NULL;
+ static struct clk *armwdt_ck;
+ static struct clk *mpu_wdt_ick;
+ static struct clk *mpu_wdt_fck;
  
  static unsigned int wdt_trgr_pattern = 0x1234;
+ static spinlock_t wdt_lock;
  
  static void omap_wdt_ping(void)
  {
@@@ -174,30 -174,29 +173,29 @@@ static int omap_wdt_release(struct inod
        return 0;
  }
  
- static ssize_t
- omap_wdt_write(struct file *file, const char __user *data,
+ static ssize_t omap_wdt_write(struct file *file, const char __user *data,
                size_t len, loff_t *ppos)
  {
        /* Refresh LOAD_TIME. */
-       if (len)
+       if (len) {
+               spin_lock(&wdt_lock);
                omap_wdt_ping();
+               spin_unlock(&wdt_lock);
+       }
        return len;
  }
  
- static int
- omap_wdt_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
+                                               unsigned long arg)
  {
        int new_margin;
-       static struct watchdog_info ident = {
+       static const struct watchdog_info ident = {
                .identity = "OMAP Watchdog",
                .options = WDIOF_SETTIMEOUT,
                .firmware_version = 0,
        };
  
        switch (cmd) {
-       default:
-               return -ENOTTY;
        case WDIOC_GETSUPPORT:
                return copy_to_user((struct watchdog_info __user *)arg, &ident,
                                sizeof(ident));
                        return put_user(omap_prcm_get_reset_sources(),
                                        (int __user *)arg);
        case WDIOC_KEEPALIVE:
+               spin_lock(&wdt_lock);
                omap_wdt_ping();
+               spin_unlock(&wdt_lock);
                return 0;
        case WDIOC_SETTIMEOUT:
                if (get_user(new_margin, (int __user *)arg))
                        return -EFAULT;
                omap_wdt_adjust_timeout(new_margin);
  
+               spin_lock(&wdt_lock);
                omap_wdt_disable();
                omap_wdt_set_timeout();
                omap_wdt_enable();
  
                omap_wdt_ping();
+               spin_unlock(&wdt_lock);
                /* Fall */
        case WDIOC_GETTIMEOUT:
                return put_user(timer_margin, (int __user *)arg);
+       default:
+               return -ENOTTY;
        }
  }
  
  static const struct file_operations omap_wdt_fops = {
        .owner = THIS_MODULE,
        .write = omap_wdt_write,
-       .ioctl = omap_wdt_ioctl,
+       .unlocked_ioctl = omap_wdt_ioctl,
        .open = omap_wdt_open,
        .release = omap_wdt_release,
  };
  static struct miscdevice omap_wdt_miscdev = {
        .minor = WATCHDOG_MINOR,
        .name = "watchdog",
-       .fops = &omap_wdt_fops
+       .fops = &omap_wdt_fops,
  };
  
  static int __init omap_wdt_probe(struct platform_device *pdev)
@@@ -373,6 -378,7 +377,7 @@@ static struct platform_driver omap_wdt_
  
  static int __init omap_wdt_init(void)
  {
+       spin_lock_init(&wdt_lock);
        return platform_driver_register(&omap_wdt_driver);
  }
  
index f431a0427eaa1c91cd238abbc6866ca2fcbf96a4,6eadf5ebb9b34ea647891b5c0da9a21a1463c0d3..0ed84162437beb913a66cdf621bde5e0d2bc9a38
  #include <linux/platform_device.h>
  #include <linux/clk.h>
  #include <linux/spinlock.h>
+ #include <linux/uaccess.h>
+ #include <linux/io.h>
 -
 -#include <asm/hardware.h>
 +#include <mach/hardware.h>
- #include <asm/uaccess.h>
- #include <asm/io.h>
  
  #define MODULE_NAME "PNX4008-WDT: "
  
@@@ -144,9 -144,8 +143,8 @@@ static int pnx4008_wdt_open(struct inod
        return nonseekable_open(inode, file);
  }
  
- static ssize_t
- pnx4008_wdt_write(struct file *file, const char *data, size_t len,
-                 loff_t * ppos)
+ static ssize_t pnx4008_wdt_write(struct file *file, const char *data,
+                                       size_t len, loff_t *ppos)
  {
        if (len) {
                if (!nowayout) {
        return len;
  }
  
- static struct watchdog_info ident = {
+ static const struct watchdog_info ident = {
        .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE |
            WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
        .identity = "PNX4008 Watchdog",
  };
  
- static int
- pnx4008_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                 unsigned long arg)
+ static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file,
+                                       unsigned int cmd, unsigned long arg)
  {
        int ret = -ENOTTY;
        int time;
                ret = put_user(boot_status, (int *)arg);
                break;
  
+       case WDIOC_KEEPALIVE:
+               wdt_enable();
+               ret = 0;
+               break;
        case WDIOC_SETTIMEOUT:
                ret = get_user(time, (int *)arg);
                if (ret)
        case WDIOC_GETTIMEOUT:
                ret = put_user(heartbeat, (int *)arg);
                break;
-       case WDIOC_KEEPALIVE:
-               wdt_enable();
-               ret = 0;
-               break;
        }
        return ret;
  }
@@@ -238,7 -236,7 +235,7 @@@ static const struct file_operations pnx
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .write = pnx4008_wdt_write,
-       .ioctl = pnx4008_wdt_ioctl,
+       .unlocked_ioctl = pnx4008_wdt_ioctl,
        .open = pnx4008_wdt_open,
        .release = pnx4008_wdt_release,
  };
index f1fe800658f408f933d437c4302172c2341e36f4,c417fb5e913fadd9a3f141117bb7385340cd3787..3da2b90d2fe6add80192c275fc8c8f7d59a1db55
@@@ -49,7 -49,7 +49,7 @@@
  #include <linux/uaccess.h>
  #include <linux/io.h>
  
 -#include <asm/arch/map.h>
 +#include <mach/map.h>
  
  #undef S3C_VA_WATCHDOG
  #define S3C_VA_WATCHDOG (0)
@@@ -115,17 -115,6 +115,6 @@@ static void s3c2410wdt_keepalive(void
        spin_unlock(&wdt_lock);
  }
  
- static void __s3c2410wdt_stop(void)
- {
-       unsigned long wtcon;
-       spin_lock(&wdt_lock);
-       wtcon = readl(wdt_base + S3C2410_WTCON);
-       wtcon &= ~(S3C2410_WTCON_ENABLE | S3C2410_WTCON_RSTEN);
-       writel(wtcon, wdt_base + S3C2410_WTCON);
-       spin_unlock(&wdt_lock);
- }
  static void __s3c2410wdt_stop(void)
  {
        unsigned long wtcon;
@@@ -305,8 -294,6 +294,6 @@@ static long s3c2410wdt_ioctl(struct fil
        int new_margin;
  
        switch (cmd) {
-       default:
-               return -ENOTTY;
        case WDIOC_GETSUPPORT:
                return copy_to_user(argp, &s3c2410_wdt_ident,
                        sizeof(s3c2410_wdt_ident)) ? -EFAULT : 0;
                return put_user(tmr_margin, p);
        case WDIOC_GETTIMEOUT:
                return put_user(tmr_margin, p);
+       default:
+               return -ENOTTY;
        }
  }
  
index 97d9da758dccd7a0977ffea9d93ec0938f4b749b,27d6898a7c983f8f987a6dc584be8ea4f099b160..31a48437dc3dba2ce22ba5ae8aef3ce72d1b7c71
  #include <linux/watchdog.h>
  #include <linux/init.h>
  #include <linux/bitops.h>
+ #include <linux/uaccess.h>
  
  #ifdef CONFIG_ARCH_PXA
 -#include <asm/arch/pxa-regs.h>
 +#include <mach/pxa-regs.h>
  #endif
  
 -#include <asm/hardware.h>
 +#include <mach/reset.h>
 +#include <mach/hardware.h>
- #include <asm/uaccess.h>
  
  #define OSCR_FREQ             CLOCK_TICK_RATE
  
@@@ -46,7 -45,7 +46,7 @@@ static int boot_status
   */
  static int sa1100dog_open(struct inode *inode, struct file *file)
  {
-       if (test_and_set_bit(1,&sa1100wdt_users))
+       if (test_and_set_bit(1, &sa1100wdt_users))
                return -EBUSY;
  
        /* Activate SA1100 Watchdog timer */
  static int sa1100dog_release(struct inode *inode, struct file *file)
  {
        printk(KERN_CRIT "WATCHDOG: Device closed - timer will not stop\n");
        clear_bit(1, &sa1100wdt_users);
        return 0;
  }
  
- static ssize_t sa1100dog_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
+ static ssize_t sa1100dog_write(struct file *file, const char __user *data,
+                                               size_t len, loff_t *ppos)
  {
        if (len)
                /* Refresh OSMR3 timer. */
                OSMR3 = OSCR + pre_margin;
        return len;
  }
  
- static struct watchdog_info ident = {
-       .options        = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
+ static const struct watchdog_info ident = {
+       .options        = WDIOF_CARDRESET | WDIOF_SETTIMEOUT
+                               | WDIOF_KEEPALIVEPING,
        .identity       = "SA1100/PXA255 Watchdog",
  };
  
- static int sa1100dog_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+ static long sa1100dog_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
  {
        int ret = -ENOTTY;
        int time;
                ret = put_user(boot_status, p);
                break;
  
+       case WDIOC_KEEPALIVE:
+               OSMR3 = OSCR + pre_margin;
+               ret = 0;
+               break;
        case WDIOC_SETTIMEOUT:
                ret = get_user(time, p);
                if (ret)
        case WDIOC_GETTIMEOUT:
                ret = put_user(pre_margin / OSCR_FREQ, p);
                break;
-       case WDIOC_KEEPALIVE:
-               OSMR3 = OSCR + pre_margin;
-               ret = 0;
-               break;
        }
        return ret;
  }
  
- static const struct file_operations sa1100dog_fops =
- {
+ static const struct file_operations sa1100dog_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = sa1100dog_write,
-       .ioctl          = sa1100dog_ioctl,
+       .unlocked_ioctl = sa1100dog_ioctl,
        .open           = sa1100dog_open,
        .release        = sa1100dog_release,
  };
  
- static struct miscdevice sa1100dog_miscdev =
- {
+ static struct miscdevice sa1100dog_miscdev = {
        .minor          = WATCHDOG_MINOR,
        .name           = "watchdog",
        .fops           = &sa1100dog_fops,
@@@ -163,14 -159,14 +160,15 @@@ static int __init sa1100dog_init(void
         * we suspend, RCSR will be cleared, and the watchdog
         * reset reason will be lost.
         */
 -      boot_status = (RCSR & RCSR_WDR) ? WDIOF_CARDRESET : 0;
 +      boot_status = (reset_status & RESET_STATUS_WATCHDOG) ?
 +                              WDIOF_CARDRESET : 0;
        pre_margin = OSCR_FREQ * margin;
  
        ret = misc_register(&sa1100dog_miscdev);
        if (ret == 0)
-               printk("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n",
-                      margin);
+               printk(KERN_INFO
+                       "SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n",
+                                               margin);
        return ret;
  }
  
index 94e2d91c9ac97806e2b1904db1dc7badd41c9b3f,fea398a4ca327189cce6d6b669f03be4cd2b29af..c8d7f1b2df026ccac80f2862667fe14a29466667
  #include <linux/reboot.h>
  #include <linux/init.h>
  #include <linux/interrupt.h>
- #include <asm/irq.h>
- #include <asm/uaccess.h>
+ #include <linux/uaccess.h>
+ #include <linux/irq.h>
 +#include <mach/hardware.h>
 -#include <asm/hardware.h>
  #include <asm/mach-types.h>
  #include <asm/hardware/dec21285.h>
  
@@@ -115,8 -115,8 +115,8 @@@ static int watchdog_release(struct inod
        return 0;
  }
  
- static ssize_t
watchdog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+ static ssize_t watchdog_write(struct file *file, const char *data,
                                              size_t len, loff_t *ppos)
  {
        /*
         *      Refresh the timer.
        return len;
  }
  
- static struct watchdog_info ident = {
+ static const struct watchdog_info ident = {
        .options        = WDIOF_SETTIMEOUT,
        .identity       = "Footbridge Watchdog",
  };
  
- static int
- watchdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-              unsigned long arg)
+ static long watchdog_ioctl(struct file *file, unsigned int cmd,
+                                                       unsigned long arg)
  {
        unsigned int new_margin;
        int ret = -ENOTTY;
  
-       switch(cmd) {
+       switch (cmd) {
        case WDIOC_GETSUPPORT:
                ret = 0;
                if (copy_to_user((void *)arg, &ident, sizeof(ident)))
  
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
-               ret = put_user(0,(int *)arg);
+               ret = put_user(0, (int *)arg);
                break;
  
        case WDIOC_KEEPALIVE:
@@@ -182,7 -181,7 +181,7 @@@ static const struct file_operations wat
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = watchdog_write,
-       .ioctl          = watchdog_ioctl,
+       .unlocked_ioctl = watchdog_ioctl,
        .open           = watchdog_open,
        .release        = watchdog_release,
  };
@@@ -204,11 -203,13 +203,13 @@@ static int __init footbridge_watchdog_i
        if (retval < 0)
                return retval;
  
-       printk("Footbridge Watchdog Timer: 0.01, timer margin: %d sec\n",
-              soft_margin);
+       printk(KERN_INFO
+               "Footbridge Watchdog Timer: 0.01, timer margin: %d sec\n",
+                                                               soft_margin);
  
        if (machine_is_cats())
-               printk("Warning: Watchdog reset may not work on this machine.\n");
+               printk(KERN_WARN
+                 "Warning: Watchdog reset may not work on this machine.\n");
        return 0;
  }
  
@@@ -223,7 -224,7 +224,7 @@@ MODULE_LICENSE("GPL")
  MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
  
  module_param(soft_margin, int, 0);
- MODULE_PARM_DESC(soft_margin,"Watchdog timeout in seconds");
+ MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds");
  
  module_init(footbridge_watchdog_init);
  module_exit(footbridge_watchdog_exit);