All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed
@ 2016-02-24  3:56 Alison Wang
  2016-02-24  4:13 ` Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alison Wang @ 2016-02-24  3:56 UTC (permalink / raw)
  To: u-boot

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@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');
 }
 
 static void _serial_puts(struct udevice *dev, const char *str)
-- 
2.1.0.27.g96db324

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed
  2016-02-24  3:56 [U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed Alison Wang
@ 2016-02-24  4:13 ` Simon Glass
  2016-02-24  4:40 ` Bin Meng
  2016-02-25  2:58 ` Bin Meng
  2 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2016-02-24  4:13 UTC (permalink / raw)
  To: u-boot

On 23 February 2016 at 20:56, Alison Wang <b18965@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@nxp.com>
> ---
>  drivers/serial/serial-uclass.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed
  2016-02-24  3:56 [U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed Alison Wang
  2016-02-24  4:13 ` Simon Glass
@ 2016-02-24  4:40 ` Bin Meng
  2016-02-24  7:35   ` Huan Wang
  2016-02-25  2:58 ` Bin Meng
  2 siblings, 1 reply; 7+ messages in thread
From: Bin Meng @ 2016-02-24  4:40 UTC (permalink / raw)
  To: u-boot

Hi Alison,

On Wed, Feb 24, 2016 at 11:56 AM, Alison Wang <b18965@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@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

Regards,
Bin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed
  2016-02-24  4:40 ` Bin Meng
@ 2016-02-24  7:35   ` Huan Wang
  2016-02-24  9:09     ` Bin Meng
  0 siblings, 1 reply; 7+ messages in thread
From: Huan Wang @ 2016-02-24  7:35 UTC (permalink / raw)
  To: u-boot

Hi, Bin,

> On Wed, Feb 24, 2016 at 11:56 AM, Alison Wang <b18965@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@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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed
  2016-02-24  7:35   ` Huan Wang
@ 2016-02-24  9:09     ` Bin Meng
  2016-02-24  9:33       ` Huan Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Bin Meng @ 2016-02-24  9:09 UTC (permalink / raw)
  To: u-boot

Hi Alison,

On Wed, Feb 24, 2016 at 3:35 PM, Huan Wang <alison.wang@nxp.com> wrote:
> Hi, Bin,
>
>> On Wed, Feb 24, 2016 at 11:56 AM, Alison Wang <b18965@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@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?
>

No, we should keep the non-DM putc function as it is now. But this
serial_mxc.c, its non-DM putc version has the same issue as the
serial-uclass.c, so it should be fixed. The legacy serial_pxa.c,
serial_s3c24x0.c and usbtty.c also have the same problem.

Regards,
Bin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed
  2016-02-24  9:09     ` Bin Meng
@ 2016-02-24  9:33       ` Huan Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Huan Wang @ 2016-02-24  9:33 UTC (permalink / raw)
  To: u-boot

Hi, Bin,

> On Wed, Feb 24, 2016 at 3:35 PM, Huan Wang <alison.wang@nxp.com> wrote:
> > Hi, Bin,
> >
> >> On Wed, Feb 24, 2016 at 11:56 AM, Alison Wang <b18965@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@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?
> >
> 
> No, we should keep the non-DM putc function as it is now. But this
> serial_mxc.c, its non-DM putc version has the same issue as the serial-
> uclass.c, so it should be fixed. The legacy serial_pxa.c,
> serial_s3c24x0.c and usbtty.c also have the same problem.
> 
> 
[Alison Wang] Ok, I get your idea. I will send another patch to fix them.

Thanks.

Best Regards,
Alison Wang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed
  2016-02-24  3:56 [U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed Alison Wang
  2016-02-24  4:13 ` Simon Glass
  2016-02-24  4:40 ` Bin Meng
@ 2016-02-25  2:58 ` Bin Meng
  2 siblings, 0 replies; 7+ messages in thread
From: Bin Meng @ 2016-02-25  2:58 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 24, 2016 at 11:56 AM, Alison Wang <b18965@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@nxp.com>
> ---
>  drivers/serial/serial-uclass.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-25  2:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-24  3:56 [U-Boot] [PATCH] dm: serial: Move a carriage return before a line feed Alison Wang
2016-02-24  4:13 ` Simon Glass
2016-02-24  4:40 ` Bin Meng
2016-02-24  7:35   ` Huan Wang
2016-02-24  9:09     ` Bin Meng
2016-02-24  9:33       ` Huan Wang
2016-02-25  2:58 ` Bin Meng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.