]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/char/watchdog/mv64x60_wdt.c
watchdog: Add a simple mmap() stub for shwdt.
[mv-sheeva.git] / drivers / char / watchdog / mv64x60_wdt.c
index 00d9ef04a3697dde00f1d2121c526c33f4ec0c5e..5c8fab345b403668a6159cc9b8a35392a0cc3b36 100644 (file)
@@ -15,7 +15,6 @@
  * or implied.
  */
 
-#include <linux/config.h>
 #include <linux/fs.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -167,7 +166,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
        return 0;
 }
 
-static struct file_operations mv64x60_wdt_fops = {
+static const struct file_operations mv64x60_wdt_fops = {
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .write = mv64x60_wdt_write,
@@ -228,15 +227,25 @@ static int __init mv64x60_wdt_init(void)
 
        printk(KERN_INFO "MV64x60 watchdog driver\n");
 
-       mv64x60_wdt_dev = platform_device_register_simple(MV64x60_WDT_NAME,
-                                                         -1, NULL, 0);
-       if (IS_ERR(mv64x60_wdt_dev)) {
-               ret = PTR_ERR(mv64x60_wdt_dev);
+       mv64x60_wdt_dev = platform_device_alloc(MV64x60_WDT_NAME, -1);
+       if (!mv64x60_wdt_dev) {
+               ret = -ENOMEM;
+               goto out;
+       }
+
+       ret = platform_device_add(mv64x60_wdt_dev);
+       if (ret) {
+               platform_device_put(mv64x60_wdt_dev);
                goto out;
        }
 
        ret = platform_driver_register(&mv64x60_wdt_driver);
-      out:
+       if (ret) {
+               platform_device_unregister(mv64x60_wdt_dev);
+               goto out;
+       }
+
+ out:
        return ret;
 }