tty: cpm_uart: use resource_size()
authorTobias Klauser <tklauser@distanz.ch>
Thu, 11 Mar 2010 22:08:18 +0000 (14:08 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 19 Mar 2010 14:17:56 +0000 (07:17 -0700)
Use the resource_size function instead of manually calculating the
resource size.  This reduces the chance of introducing off-by-one errors.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Kumar Gala <galak@gate.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/serial/cpm_uart/cpm_uart_cpm2.c

index a9802e76b5fabbd91f44adedb16708fda49f289b..722eac18f382c057453085e45f467d7314a678a9 100644 (file)
@@ -61,7 +61,7 @@ void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
        void __iomem *pram;
        unsigned long offset;
        struct resource res;
-       unsigned long len;
+       resource_size_t len;
 
        /* Don't remap parameter RAM if it has already been initialized
         * during console setup.
@@ -74,7 +74,7 @@ void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
        if (of_address_to_resource(np, 1, &res))
                return NULL;
 
-       len = 1 + res.end - res.start;
+       len = resource_size(&res);
        pram = ioremap(res.start, len);
        if (!pram)
                return NULL;