From: Steffen Trumtrar Date: Thu, 17 Feb 2022 21:18:39 +0000 (+0100) Subject: serial: 8250: Return early in .start_tx() if there are no chars to send X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=932d596378b0253354246f4aa3662add4883a167;p=linux.git serial: 8250: Return early in .start_tx() if there are no chars to send Don't start the whole chain for TX if there is no data to send. This is mostly relevant for rs485 mode as there might be rts-before-send and rts-after-send delays involved. Signed-off-by: Steffen Trumtrar Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20220217211839.443039-1-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 973870ebff694..728d60be89759 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1665,6 +1665,9 @@ static void serial8250_start_tx(struct uart_port *port) serial8250_rpm_get_tx(up); + if (!port->x_char && uart_circ_empty(&port->state->xmit)) + return; + if (em485 && em485->active_timer == &em485->start_tx_timer) return;