[U-Boot] [PATCH 1/7] dm: serial: fix a bug of console putc
Simon Glass
sjg at chromium.org
Thu Oct 23 01:36:06 CEST 2014
Hi Masahiro,
On 22 October 2014 03:13, Masahiro Yamada <yamada.m at jp.panasonic.com> wrote:
> Without this commit, functions such as printf(), puts() stop working
> after the console is ready (= after GD_FLG_DEVINIT is set in
> console_init_r() function).
>
> The function serial_putc() is called to print a character before the
> console is available, while serial_stub_putc() is used on the console.
>
> The cause of the problem is that the error handling of ops->putc
> handler is missing from serial_stub_putc(); it should behave
> like serial_putc().
>
> Signed-off-by: Masahiro Yamada <yamada.m at jp.panasonic.com>
> ---
>
> drivers/serial/serial-uclass.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
> index 6dde4ea..163308b 100644
> --- a/drivers/serial/serial-uclass.c
> +++ b/drivers/serial/serial-uclass.c
> @@ -127,8 +127,13 @@ void serial_stub_putc(struct stdio_dev *sdev, const char ch)
> {
> struct udevice *dev = sdev->priv;
> struct dm_serial_ops *ops = serial_get_ops(dev);
> + int err;
>
> - ops->putc(dev, ch);
> + do {
> + err = ops->putc(cur_dev, ch);
> + } while (err == -EAGAIN);
> + if (ch == '\n')
> + serial_putc('\r');
> }
>
> void serial_stub_puts(struct stdio_dev *sdev, const char *str)
> --
> 1.9.1
>
Sorry for the bug, but I did fix it some weeks OK. Please see this patch:
http://patchwork.ozlabs.org/patch/395725/
I recommend basing on dm/working if you are sending new patches
because code there is generally on its way upstream ahead of your
patch.
I will see if I can start using dm/testing more, as that is really its
intended purpose.
Regards,
Simon
More information about the U-Boot
mailing list