[PATCH v2 11/12] serial: imx: don't prepare to send if no data is available

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

 



serial_core might call the .start_tx callback without any data being
available to send. In this case return early instead of going through
all the setup needed for sending which might include disabling RX in
RS485 half-duplex mode.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index ee39d776bd45..95fdc639bc0c 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -651,6 +651,9 @@ static void imx_start_tx(struct uart_port *port)
 	struct imx_port *sport = (struct imx_port *)port;
 	u32 ucr1;
 
+	if (!sport->port.x_char && uart_circ_empty(&port->state->xmit))
+		return;
+
 	if (port->rs485.flags & SER_RS485_ENABLED) {
 		u32 ucr2;
 
-- 
2.16.1

--
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