[PATCH v2 3/7] tty/serial: convert 8250 to generic earlycon

Rob Herring robherring2 at gmail.com
Mon Apr 28 16:20:53 PDT 2014


On Sat, Apr 26, 2014 at 1:19 AM, Yinghai Lu <yinghai at kernel.org> wrote:
> On Fri, Apr 18, 2014 at 3:19 PM, Rob Herring <robherring2 at gmail.com> wrote:
>> From: Rob Herring <robh at kernel.org>
>>
>> With the generic earlycon infrastructure in place, convert the 8250
>> early console to use it.
>>
>> Signed-off-by: Rob Herring <robh at kernel.org>
>> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
>> Cc: Jiri Slaby <jslaby at suse.cz>
>> ---
>>  drivers/tty/serial/8250/8250_early.c | 138 ++++-------------------------------
>>  drivers/tty/serial/8250/Kconfig      |   1 +
>>  2 files changed, 16 insertions(+), 123 deletions(-)
>
> Hi Greg, Rob
>
> This one in tty-next breaks booting: "console=uart8250,io,0x3f8,115200".
> No early console and regular console anymore.
>
> It should produce "early con and regular con".

This is what I get for running checkpatch and converting
simple_strtoul to kstrto* which are not so equivalent. kstrto* will
not convert things such as 115200n8 to a number.

Greg, Do you want a fix or for me to respin the series? The fix looks like this:

diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 73bf1e2..c92e830 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -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);



More information about the linux-arm-kernel mailing list