Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
[firefly-linux-kernel-4.4.55.git] / drivers / watchdog / rc32434_wdt.c
index f78bc008cbb71b5695b00b5e6c4edec4509f2175..71e78ef4b736a1b035e69f5cef063b3a528aaebc 100644 (file)
 #include <linux/errno.h>               /* For the -ENODEV/... values */
 #include <linux/kernel.h>              /* For printk/panic/... */
 #include <linux/fs.h>                  /* For file operations */
-#include <linux/miscdevice.h>          /* For MODULE_ALIAS_MISCDEV
-                                                       (WATCHDOG_MINOR) */
+#include <linux/miscdevice.h>          /* For struct miscdevice */
 #include <linux/watchdog.h>            /* For the watchdog specific items */
 #include <linux/init.h>                        /* For __init/__exit/... */
 #include <linux/platform_device.h>     /* For platform_driver framework */
 #include <linux/spinlock.h>            /* For spin_lock/spin_unlock/... */
 #include <linux/uaccess.h>             /* For copy_to_user/put_user/... */
+#include <linux/io.h>                  /* For devm_ioremap_nocache */
 
 #include <asm/mach-rc32434/integ.h>    /* For the Watchdog registers */
 
@@ -271,7 +271,7 @@ static int rc32434_wdt_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       wdt_reg = ioremap_nocache(r->start, resource_size(r));
+       wdt_reg = devm_ioremap_nocache(&pdev->dev, r->start, resource_size(r));
        if (!wdt_reg) {
                pr_err("failed to remap I/O resources\n");
                return -ENXIO;
@@ -293,23 +293,18 @@ static int rc32434_wdt_probe(struct platform_device *pdev)
        ret = misc_register(&rc32434_wdt_miscdev);
        if (ret < 0) {
                pr_err("failed to register watchdog device\n");
-               goto unmap;
+               return ret;
        }
 
        pr_info("Watchdog Timer version " VERSION ", timer margin: %d sec\n",
                timeout);
 
        return 0;
-
-unmap:
-       iounmap(wdt_reg);
-       return ret;
 }
 
 static int rc32434_wdt_remove(struct platform_device *pdev)
 {
        misc_deregister(&rc32434_wdt_miscdev);
-       iounmap(wdt_reg);
        return 0;
 }
 
@@ -333,4 +328,3 @@ MODULE_AUTHOR("Ondrej Zajicek <santiago@crfreenet.org>,"
                "Florian Fainelli <florian@openwrt.org>");
 MODULE_DESCRIPTION("Driver for the IDT RC32434 SoC watchdog");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);