Re: [PATCH] serial: bfin_uart: Don't switch baud rate untill the transfer buffer is empty.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 07, 2012 at 12:55:42PM +0800, Sonic Zhang wrote:
> From: Sonic Zhang <sonic.zhang@xxxxxxxxxx>
> 
> set_termios may be invoked before the former data transfer is completed. Block until the
> tranfer is done.
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@xxxxxxxxxx>
> ---
>  drivers/tty/serial/bfin_uart.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
> index 9242d56..71c0c09 100644
> --- a/drivers/tty/serial/bfin_uart.c
> +++ b/drivers/tty/serial/bfin_uart.c
> @@ -869,6 +869,10 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
>  
>  	UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15);
>  
> +	/* Wait till the transfer buffer is empty */
> +	while (UART_GET_GCTL(uart) & UCEN && !(UART_GET_LSR(uart) & TEMT))
> +		barrier();

Where is the "the hardware is hung" break out of this loop?

And why "barrier()"?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux