Skip to content

Commit 8d5b305

Browse files
l1kgregkh
authored andcommitted
serial: 8250: Optimize irq enable after console write
Commit 7f98030 ("serial: 8250: Support console on software emulated rs485 ports") amended serial8250_console_write() with rs485 support, but positioned the invocation of ->rs485_stop_tx() after re-enablement of interrupts. The irq handler and ->console_write() are serialized with the port spinlock, so no problem there, but due to the rs485 delay, the irq handler may unnecessarily spin for a while. Avoid that by moving ->rs485_stop_tx() before re-enablement of interrupts, which also mirrors the order at the beginning of serial8250_console_write(). Signed-off-by: Lukas Wunner <[email protected]> Link: https://lore.kernel.org/r/019839cb1f61b01210b6ff9ac9f9079ca77f8411.1585319447.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4e36f94 commit 8d5b305

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/tty/serial/8250/8250_port.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3268,14 +3268,15 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
32683268
* and restore the IER
32693269
*/
32703270
wait_for_xmitr(up, BOTH_EMPTY);
3271-
serial_port_out(port, UART_IER, ier);
32723271

32733272
if (em485) {
32743273
mdelay(port->rs485.delay_rts_after_send);
32753274
if (em485->tx_stopped)
32763275
up->rs485_stop_tx(up);
32773276
}
32783277

3278+
serial_port_out(port, UART_IER, ier);
3279+
32793280
/*
32803281
* The receive handling will happen properly because the
32813282
* receive ready bit will still be set; it is not cleared

0 commit comments

Comments
 (0)