tty/serial: add back missing setup_early_serial8250_console
PATCH 1/2 tty/serial: add back missing setup_early_serial8250_console
From: Rob Herring <[email protected]>
Commit d2fd6810a823bcd (tty/serial: convert 8250 to generic earlycon) removed setup_early_serial8250_console, but there are still 2 callers in:
arch/mips/mti-malta/malta-init.cdrivers/firmware/pcdp.c
Add back the function implemented as a wrapper to setup_earlycon.
--- drivers/tty/serial/8250/8250_early.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/tty/serial/8250/8250_early.c +10 -0
@@ -156,6 +156,16 @@ static int __init early_serial8250_setup(struct earlycon_device *device,EARLYCON_DECLARE (uart8250, early_serial8250_setup);EARLYCON_DECLARE (uart, early_serial8250_setup); +int __init setup_early_serial8250_console (char *cmdline) +{ +char match[] ="uart8250" ; + +if (cmdline && cmdline[4 ] ==',' ) + match[4 ] ='\0' ; + +return setup_earlycon (cmdline, match, early_serial8250_setup); +} +int serial8250_find_port_for_earlycon (void ) {struct earlycon_device *device = early_device;
Signature · 1 line
1.9.1
PATCH 2/2 tty/serial: fix generic earlycon option parsing
From: Rob Herring <[email protected]>
Commit 9aac5887595 (tty/serial: add generic serial earlycon) moved console option parsing from 8250_early.c and converted to kstrto* functions from simple_strtoul along the way. However, kstrto* functions are not equivalent in that they do not allow non-convertible characters at the end such as "115200n8". Fix this by changing back to simple_strtoul and ignore what checkpatch.pl says.
--- drivers/tty/serial/earlycon.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
drivers/tty/serial/earlycon.c +5 -13
@@ -53,7 +53,7 @@ static int __init parse_options(struct earlycon_device *device, char *options) {struct uart_port *port = &device->port; -int mmio, mmio32, length, ret; +int mmio, mmio32, length;unsigned long addr;if (!options)
@@ -64,25 +64,19 @@ static int __init parse_options(struct earlycon_device *device,if (mmio || mmio32) { port->iotype = (mmio ?UPIO_MEM :UPIO_MEM32 ); options += mmio ?5 :7 ; - ret =kstrtoul (options,0 , &addr); -if (ret) -return ret; + addr =simple_strtoul (options,NULL ,0 ); port->mapbase = addr;if (mmio32) port->regshift =2 ; }else if (!strncmp (options,"io," ,3 )) { port->iotype =UPIO_PORT ; options +=3 ; - ret =kstrtoul (options,0 , &addr); -if (ret) -return ret; + addr =simple_strtoul (options,NULL ,0 ); port->iobase = addr; mmio =0 ; }else if (!strncmp (options,"0x" ,2 )) { port->iotype =UPIO_MEM ; - ret =kstrtoul (options,0 , &addr); -if (ret) -return ret; + addr =simple_strtoul (options,NULL ,0 ); port->mapbase = addr; }else {return -EINVAL ;
@@ -93,9 +87,7 @@ static int __init parse_options(struct earlycon_device *device, options =strchr (options,',' );if (options) { options++; - ret =kstrtouint (options,0 , &device->baud); -if (ret) -return ret; + device->baud =simple_strtoul (options,NULL ,0 ); length =min (strcspn (options," " ) +1 , (size_t )(sizeof (device->options)));strlcpy (device->options, options, length);
Signature · 1 line
1.9.1