[U-Boot] [PATCH 2/6] serial: add UniPhier serial driver

Masahiro Yamada yamada.m at jp.panasonic.com
Thu Jul 10 12:06:50 CEST 2014


Hi Marek,


On Fri, 4 Jul 2014 16:40:29 +0200
Marek Vasut <marex at denx.de> wrote:


> > +static void uniphier_serial_init(struct uniphier_serial *port)
> > +{
> > +	writeb(UART_LCR_WLS_8, &port->lcr);
> > +
> > +#define MODE_X_DIV 16
> 
> You can use just const unsigned here instead of #define.


I adjusted drivers/serial/serial_ns16550.c for my own.

Is using a macro here so bad?
If so, should I also fix the line 138 of drivers/serial/serial_ns16550.c ?




> > +static void uniphier_serial_putc(struct uniphier_serial *port, const char
> > c) +{
> > +	if (c == '\n')
> > +		uniphier_serial_putc(port, '\r');
> > +
> > +	while (!(readb(&port->lsr) & UART_LSR_THRE))
> > +		;
> 
> I think in this function, you can avoid such completely unbounded loop.
> 
> [...]


Why?
Could you give me more detailed explanation?



Best Regards
Masahiro Yamada



More information about the U-Boot mailing list