On 17. 02. 22, 22:18, Uwe Kleine-König wrote:
From: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
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 <s.trumtrar@xxxxxxxxxxxxxx>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
Hello,
a few other drivers have such an early exit already (imx, stm32-usart).
I wonder if it applies to all UART drivers that there is nothing to do
in .start_tx() if the circ buffer is empty and there is no x_char to
send. In this case it would be more sensible to ensure in serial_core
that .start_tx() is only ever called if there is something to do.
Not sure if all, but most yes. I have a series to add a TX helper which
unifies those and removes all those cut&pasted code. It's not finished
yet. Look at the top of:
https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git/log/?h=devel
Best regards
Uwe
drivers/tty/serial/8250/8250_port.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 3b12bfc1ed67..5d4668f12f71 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1657,6 +1657,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;
base-commit: 754e0b0e35608ed5206d6a67a791563c631cec07
--
js
suse labs