summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/serial_core.c
diff options
context:
space:
mode:
authorAlexander Sverdlin <alexander.sverdlin@nokia.com>2016-09-02 13:20:21 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-02 15:03:35 +0200
commit46e36683f433528bfb7e5754ca5c5c86c204c40a (patch)
tree21d6c4a885ea8fb7c7ee64ed7f77b845281e5980 /drivers/tty/serial/serial_core.c
parent8f975fe49dba5d15a828f34ad8ec3dc8beb60ca0 (diff)
downloadlinux-stable-46e36683f433528bfb7e5754ca5c5c86c204c40a.tar.gz
linux-stable-46e36683f433528bfb7e5754ca5c5c86c204c40a.tar.bz2
linux-stable-46e36683f433528bfb7e5754ca5c5c86c204c40a.zip
serial: earlycon: Extend earlycon command line option to support 64-bit addresses
earlycon implementation used "unsigned long" internally, but there are systems (ARM with LPAE) where sizeof(unsigned long) == 4 and uart is mapped beyond 4GiB address range. Switch to resource_size_t internally and replace obsoleted simple_strtoul() with kstrtoull(). Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/serial_core.c')
-rw-r--r--drivers/tty/serial/serial_core.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index e183d2eff16d..240d3e7a548c 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1892,11 +1892,14 @@ uart_get_console(struct uart_port *ports, int nr, struct console *co)
* console=<name>,0x<addr>,<options>
* is also accepted; the returned @iotype will be UPIO_MEM.
*
- * Returns 0 on success or -EINVAL on failure
+ * Returns 0 on success, -EINVAL or -ERANGE on failure
*/
-int uart_parse_earlycon(char *p, unsigned char *iotype, unsigned long *addr,
+int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
char **options)
{
+ int ret;
+ unsigned long long tmp;
+
if (strncmp(p, "mmio,", 5) == 0) {
*iotype = UPIO_MEM;
p += 5;
@@ -1922,7 +1925,10 @@ int uart_parse_earlycon(char *p, unsigned char *iotype, unsigned long *addr,
return -EINVAL;
}
- *addr = simple_strtoul(p, NULL, 0);
+ ret = kstrtoull(p, 0, &tmp);
+ if (ret)
+ return ret;
+ *addr = tmp;
p = strchr(p, ',');
if (p)
p++;