Commit 98b49680 authored by Alexander Shiyan's avatar Alexander Shiyan Committed by Greg Kroah-Hartman

serial: max310x: Fix tx_empty() callback

[ Upstream commit a8da3c78 ]

Function max310x_tx_empty() accesses the IRQSTS register, which is
cleared by IC when reading, so if there is an interrupt status, we
will lose it. This patch implement the transmitter check only by
the current FIFO level.
Signed-off-by: default avatarAlexander Shiyan <shc_work@mail.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 4104d973
...@@ -844,12 +844,9 @@ static void max310x_wq_proc(struct work_struct *ws) ...@@ -844,12 +844,9 @@ static void max310x_wq_proc(struct work_struct *ws)
static unsigned int max310x_tx_empty(struct uart_port *port) static unsigned int max310x_tx_empty(struct uart_port *port)
{ {
unsigned int lvl, sts; u8 lvl = max310x_port_read(port, MAX310X_TXFIFOLVL_REG);
lvl = max310x_port_read(port, MAX310X_TXFIFOLVL_REG); return lvl ? 0 : TIOCSER_TEMT;
sts = max310x_port_read(port, MAX310X_IRQSTS_REG);
return ((sts & MAX310X_IRQ_TXEMPTY_BIT) && !lvl) ? TIOCSER_TEMT : 0;
} }
static unsigned int max310x_get_mctrl(struct uart_port *port) static unsigned int max310x_get_mctrl(struct uart_port *port)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment