]> git.sur5r.net Git - u-boot/commitdiff
dm: serial-uclass: Move a carriage return before a line feed
authorAlison Wang <b18965@freescale.com>
Wed, 2 Mar 2016 03:00:36 +0000 (11:00 +0800)
committerSimon Glass <sjg@chromium.org>
Mon, 14 Mar 2016 21:34:50 +0000 (15:34 -0600)
In general, a carriage return needs to execute before a line feed. The
patch is to change serial DM driver serial-uclass.c based on this rule.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/serial/serial-uclass.c

index 1c447ff27aa17d12435c48b62df8e490dc55b1ae..f154eb156ca3c02aae825caff946c9320131535f 100644 (file)
@@ -123,11 +123,12 @@ static void _serial_putc(struct udevice *dev, char ch)
        struct dm_serial_ops *ops = serial_get_ops(dev);
        int err;
 
+       if (ch == '\n')
+               _serial_putc(dev, '\r');
+
        do {
                err = ops->putc(dev, ch);
        } while (err == -EAGAIN);
-       if (ch == '\n')
-               _serial_putc(dev, '\r');
 }
 
 static void _serial_puts(struct udevice *dev, const char *str)