summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorRautkoski Kimmo EXT <ext-kimmo.rautkoski@vaisala.com>2019-05-24 09:19:22 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-31 07:24:38 +0200
commitd7d97f4696916fa6010e15d0730a6c4e8e765f2e (patch)
tree97b2ab32f1c464107ee11e0a15148366e54c2d48 /drivers/tty/serial
parentf3399d6e5def2877ad6febd973012a9816b5e3ba (diff)
downloadlinux-stable-d7d97f4696916fa6010e15d0730a6c4e8e765f2e.tar.gz
linux-stable-d7d97f4696916fa6010e15d0730a6c4e8e765f2e.tar.bz2
linux-stable-d7d97f4696916fa6010e15d0730a6c4e8e765f2e.zip
serial: 8250: Fix TX interrupt handling condition
[ Upstream commit db1b5bc047b3cadaedab3826bba82c3d9e023c4b ] Interrupt handler checked THRE bit (transmitter holding register empty) in LSR to detect if TX fifo is empty. In case when there is only receive interrupts the TX handling got called because THRE bit in LSR is set when there is no transmission (FIFO empty). TX handling caused TX stop, which in RS-485 half-duplex mode actually resets receiver FIFO. This is not desired during reception because of possible data loss. The fix is to check if THRI is set in IER in addition of the TX fifo status. THRI in IER is set when TX is started and cleared when TX is stopped. This ensures that TX handling is only called when there is really transmission on going and an interrupt for THRE and not when there are only RX interrupts. Signed-off-by: Kimmo Rautkoski <ext-kimmo.rautkoski@vaisala.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/8250/8250_port.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 682300713be4..eb2e2d141c01 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1874,7 +1874,8 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
status = serial8250_rx_chars(up, status);
}
serial8250_modem_status(up);
- if ((!up->dma || up->dma->tx_err) && (status & UART_LSR_THRE))
+ if ((!up->dma || up->dma->tx_err) && (status & UART_LSR_THRE) &&
+ (up->ier & UART_IER_THRI))
serial8250_tx_chars(up);
uart_unlock_and_check_sysrq(port, flags);