summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/max310x.c
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2018-12-19 12:19:20 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-19 13:48:45 +0100
commita8da3c7873ea57acb8f9cea58c0af477522965aa (patch)
tree8794b4f7346916054e6a8c9be54ed4d9bee4d763 /drivers/tty/serial/max310x.c
parentdt-bindings: serial: sh-sci: Document r8a774c0 bindings (diff)
downloadlinux-a8da3c7873ea57acb8f9cea58c0af477522965aa.tar.xz
linux-a8da3c7873ea57acb8f9cea58c0af477522965aa.zip
serial: max310x: Fix tx_empty() callback
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: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/max310x.c')
-rw-r--r--drivers/tty/serial/max310x.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 3db48fcd6068..4f479841769a 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -833,12 +833,9 @@ static void max310x_wq_proc(struct work_struct *ws)
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);
- sts = max310x_port_read(port, MAX310X_IRQSTS_REG);
-
- return ((sts & MAX310X_IRQ_TXEMPTY_BIT) && !lvl) ? TIOCSER_TEMT : 0;
+ return lvl ? 0 : TIOCSER_TEMT;
}
static unsigned int max310x_get_mctrl(struct uart_port *port)