commit: http://blackfin.uclinux.org/git/?p=linux-kernel;a=commitdiff;h=5d92e7a4fd8625e9bc2dbc6587bcfb4024e8c34b branch: http://blackfin.uclinux.org/git/?p=linux-kernel;a=shortlog;h=refs/heads/trunk
Signed-off-by: Sonic Zhang <[email protected]> --- drivers/tty/serial/bfin_uart.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c index 3dcfff4..1dfff5b 100644 --- a/drivers/tty/serial/bfin_uart.c +++ b/drivers/tty/serial/bfin_uart.c @@ -799,6 +799,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, unsigned long flags; unsigned int baud, quot; unsigned int ier, lcr = 0; + unsigned long timeout; switch (termios->c_cflag & CSIZE) { case CS8: @@ -869,8 +870,12 @@ 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 */ + timeout = jiffies + msecs_to_jiffies(10); while (UART_GET_GCTL(uart) & UCEN && !(UART_GET_LSR(uart) & TEMT)) - barrier(); + if (time_after(jiffies, timeout)) { + dev_warn(port->dev, "timeout waiting for TX buffer empty\n"); + break; + } /* Disable UART */ ier = UART_GET_IER(uart);
_______________________________________________ Linux-kernel-commits mailing list [email protected] https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits
