OMAP: LCD LS037V7DW01: Add Backlight driver support
[safe/jmp/linux-2.6] / drivers / watchdog / at32ap700x_wdt.c
index ae0fca5..1cddf92 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/uaccess.h>
 #include <linux/io.h>
 #include <linux/spinlock.h>
+#include <linux/slab.h>
 
 #define TIMEOUT_MIN            1
 #define TIMEOUT_MAX            2
@@ -202,7 +203,7 @@ static int at32_wdt_get_status(void)
        return status;
 }
 
-static struct watchdog_info at32_wdt_info = {
+static const struct watchdog_info at32_wdt_info = {
        .identity       = "at32ap700x watchdog",
        .options        = WDIOF_SETTIMEOUT |
                          WDIOF_KEEPALIVEPING |
@@ -212,8 +213,8 @@ static struct watchdog_info at32_wdt_info = {
 /*
  * Handle commands from user-space.
  */
-static int at32_wdt_ioctl(struct inode *inode, struct file *file,
-               unsigned int cmd, unsigned long arg)
+static long at32_wdt_ioctl(struct file *file,
+                               unsigned int cmd, unsigned long arg)
 {
        int ret = -ENOTTY;
        int time;
@@ -221,27 +222,10 @@ static int at32_wdt_ioctl(struct inode *inode, struct file *file,
        int __user *p = argp;
 
        switch (cmd) {
-       case WDIOC_KEEPALIVE:
-               at32_wdt_pat();
-               ret = 0;
-               break;
        case WDIOC_GETSUPPORT:
                ret = copy_to_user(argp, &at32_wdt_info,
                                sizeof(at32_wdt_info)) ? -EFAULT : 0;
                break;
-       case WDIOC_SETTIMEOUT:
-               ret = get_user(time, p);
-               if (ret)
-                       break;
-               ret = at32_wdt_settimeout(time);
-               if (ret)
-                       break;
-               /* Enable new time value */
-               at32_wdt_start();
-               /* fall through */
-       case WDIOC_GETTIMEOUT:
-               ret = put_user(wdt->timeout, p);
-               break;
        case WDIOC_GETSTATUS:
                ret = put_user(0, p);
                break;
@@ -258,6 +242,23 @@ static int at32_wdt_ioctl(struct inode *inode, struct file *file,
                        at32_wdt_start();
                ret = 0;
                break;
+       case WDIOC_KEEPALIVE:
+               at32_wdt_pat();
+               ret = 0;
+               break;
+       case WDIOC_SETTIMEOUT:
+               ret = get_user(time, p);
+               if (ret)
+                       break;
+               ret = at32_wdt_settimeout(time);
+               if (ret)
+                       break;
+               /* Enable new time value */
+               at32_wdt_start();
+               /* fall through */
+       case WDIOC_GETTIMEOUT:
+               ret = put_user(wdt->timeout, p);
+               break;
        }
 
        return ret;
@@ -283,7 +284,7 @@ static ssize_t at32_wdt_write(struct file *file, const char __user *data,
                         */
                        for (i = 0; i != len; i++) {
                                char c;
-                               if (get_user(c, data+i))
+                               if (get_user(c, data + i))
                                        return -EFAULT;
                                if (c == 'V')
                                        expect_release = 42;
@@ -298,7 +299,7 @@ static ssize_t at32_wdt_write(struct file *file, const char __user *data,
 static const struct file_operations at32_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
-       .ioctl          = at32_wdt_ioctl,
+       .unlocked_ioctl = at32_wdt_ioctl,
        .open           = at32_wdt_open,
        .release        = at32_wdt_close,
        .write          = at32_wdt_write,
@@ -326,7 +327,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
-       wdt->regs = ioremap(regs->start, regs->end - regs->start + 1);
+       wdt->regs = ioremap(regs->start, resource_size(regs));
        if (!wdt->regs) {
                ret = -ENOMEM;
                dev_dbg(&pdev->dev, "could not map I/O memory\n");
@@ -391,7 +392,6 @@ static int __exit at32_wdt_remove(struct platform_device *pdev)
                wdt = NULL;
                platform_set_drvdata(pdev, NULL);
        }
-
        return 0;
 }