summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Organov <sorganov@gmail.com>2019-08-28 14:37:51 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-09-04 06:43:55 -0400
commit2eda5345e4ef61b35101b4fef58417a41d8d53fd (patch)
tree0b0cfa5dca79ed8ab82a0ca1f91a8e336c401bfa
parent8016c3da0cc263f257e802fae36482eaad2d04fa (diff)
serial: imx: get rid of unbounded busy-waiting loop
imx_set_termios(): remove busy-waiting "drain Tx FIFO" loop. Worse yet, it was potentially unbounded wait due to RTS/CTS (hardware) handshake. Let user space ensure draining is done before termios change, if draining is needed in the first place. Signed-off-by: Sergey Organov <sorganov@gmail.com> Link: https://lore.kernel.org/r/1567017475-11919-2-git-send-email-sorganov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/imx.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index d9a73c7683ea..47b6156f5b2c 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1644,7 +1644,7 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios,
1644 uart_update_timeout(port, termios->c_cflag, baud); 1644 uart_update_timeout(port, termios->c_cflag, baud);
1645 1645
1646 /* 1646 /*
1647 * disable interrupts and drain transmitter 1647 * disable interrupts
1648 */ 1648 */
1649 old_ucr1 = imx_uart_readl(sport, UCR1); 1649 old_ucr1 = imx_uart_readl(sport, UCR1);
1650 imx_uart_writel(sport, 1650 imx_uart_writel(sport,
@@ -1652,9 +1652,6 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios,
1652 UCR1); 1652 UCR1);
1653 imx_uart_writel(sport, old_ucr2 & ~UCR2_ATEN, UCR2); 1653 imx_uart_writel(sport, old_ucr2 & ~UCR2_ATEN, UCR2);
1654 1654
1655 while (!(imx_uart_readl(sport, USR2) & USR2_TXDC))
1656 barrier();
1657
1658 /* then, disable everything */ 1655 /* then, disable everything */
1659 imx_uart_writel(sport, old_ucr2 & ~(UCR2_TXEN | UCR2_RXEN | UCR2_ATEN), UCR2); 1656 imx_uart_writel(sport, old_ucr2 & ~(UCR2_TXEN | UCR2_RXEN | UCR2_ATEN), UCR2);
1660 1657