watchdog: sbc_fitpc2_wdt: fixed I/O operations order
[safe/jmp/linux-2.6] / drivers / watchdog / mpcore_wdt.c
index 3c4f955..016c6a7 100644 (file)
@@ -4,8 +4,8 @@
  *     (c) Copyright 2004 ARM Limited
  *
  *     Based on the SoftDog driver:
- *     (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved.
- *                             http://www.redhat.com
+ *     (c) Copyright 1996 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
@@ -30,6 +30,7 @@
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/uaccess.h>
+#include <linux/slab.h>
 
 #include <asm/hardware/arm_twd.h>
 
@@ -61,7 +62,9 @@ MODULE_PARM_DESC(nowayout,
 #define ONLY_TESTING   0
 static int mpcore_noboot = ONLY_TESTING;
 module_param(mpcore_noboot, int, 0);
-MODULE_PARM_DESC(mpcore_noboot, "MPcore watchdog action, set to 1 to ignore reboots, 0 to reboot (default=" __MODULE_STRING(ONLY_TESTING) ")");
+MODULE_PARM_DESC(mpcore_noboot, "MPcore watchdog action, "
+       "set to 1 to ignore reboots, 0 to reboot (default="
+                                       __MODULE_STRING(ONLY_TESTING) ")");
 
 /*
  *     This is the interrupt handler.  Note that we only use this
@@ -211,7 +214,7 @@ static ssize_t mpcore_wdt_write(struct file *file, const char *data,
        return len;
 }
 
-static struct watchdog_info ident = {
+static const struct watchdog_info ident = {
        .options                = WDIOF_SETTIMEOUT |
                                  WDIOF_KEEPALIVEPING |
                                  WDIOF_MAGICCLOSE,
@@ -348,7 +351,7 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)
                ret = -ENXIO;
                goto err_free;
        }
-       wdt->base = ioremap(res->start, res->end - res->start + 1);
+       wdt->base = ioremap(res->start, resource_size(res));
        if (!wdt->base) {
                ret = -ENOMEM;
                goto err_free;
@@ -377,13 +380,13 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)
 
        return 0;
 
- err_irq:
+err_irq:
        misc_deregister(&mpcore_wdt_miscdev);
- err_misc:
+err_misc:
        iounmap(wdt->base);
- err_free:
+err_free:
        kfree(wdt);
- err_out:
+err_out:
        return ret;
 }
 
@@ -416,7 +419,8 @@ static struct platform_driver mpcore_wdt_driver = {
        },
 };
 
-static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n";
+static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. "
+               "mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n";
 
 static int __init mpcore_wdt_init(void)
 {