[U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed

Huan Wang alison.wang at nxp.com
Wed Feb 24 08:35:08 CET 2016


Hi, Bin,

> On Wed, Feb 24, 2016 at 11:56 AM, Alison Wang <b18965 at freescale.com>
> wrote:
> > In general, a carriage return needs to execute before a line feed.
> > The patch is to change serial DM driver based on this rule.
> >
> > Signed-off-by: Alison Wang <alison.wang at nxp.com>
> > ---
> >  drivers/serial/serial-uclass.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/serial/serial-uclass.c
> > b/drivers/serial/serial-uclass.c index 1c447ff..f154eb1 100644
> > --- a/drivers/serial/serial-uclass.c
> > +++ b/drivers/serial/serial-uclass.c
> > @@ -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');
> >  }
> >
> 
> We should also clean up all DM serial driver to remove this handling in
> their driver. eg: serial_lpuart.c/serial_mxc.c
> 
[Alison Wang] Thanks for your advice. Yes, I agree. This handling in
particular driver is redundant.

It seems only serial_lpuart.c and serial_arc.c has this handling. For
serial_mxc.c, this handling is only in the non-DM .putc function,
but not in the DM .putc function. Do you think it is necessary to change
the non-DM .putc function?

Best Regards,
Alison Wang


More information about the U-Boot mailing list