Commit 1ce09dea authored by Vignesh Raghavendra's avatar Vignesh Raghavendra Committed by Greg Kroah-Hartman

serial: 8250: 8250_omap: Terminate DMA before pushing data on RX timeout

[ Upstream commit 7cf4df30 ]

Terminate and flush DMA internal buffers, before pushing RX data to
higher layer. Otherwise, this will lead to data corruption, as driver
would end up pushing stale buffer data to higher layer while actual data
is still stuck inside DMA hardware and has yet not arrived at the
memory.
While at that, replace deprecated dmaengine_terminate_all() with
dmaengine_terminate_async().
Signed-off-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
Link: https://lore.kernel.org/r/20200319110344.21348-2-vigneshr@ti.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent cd8dda53
...@@ -773,7 +773,10 @@ static void __dma_rx_do_complete(struct uart_8250_port *p) ...@@ -773,7 +773,10 @@ static void __dma_rx_do_complete(struct uart_8250_port *p)
dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state); dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
count = dma->rx_size - state.residue; count = dma->rx_size - state.residue;
if (count < dma->rx_size)
dmaengine_terminate_async(dma->rxchan);
if (!count)
goto unlock;
ret = tty_insert_flip_string(tty_port, dma->rx_buf, count); ret = tty_insert_flip_string(tty_port, dma->rx_buf, count);
p->port.icount.rx += ret; p->port.icount.rx += ret;
...@@ -811,7 +814,6 @@ static void omap_8250_rx_dma_flush(struct uart_8250_port *p) ...@@ -811,7 +814,6 @@ static void omap_8250_rx_dma_flush(struct uart_8250_port *p)
spin_unlock_irqrestore(&priv->rx_dma_lock, flags); spin_unlock_irqrestore(&priv->rx_dma_lock, flags);
__dma_rx_do_complete(p); __dma_rx_do_complete(p);
dmaengine_terminate_all(dma->rxchan);
} }
static int omap_8250_rx_dma(struct uart_8250_port *p) static int omap_8250_rx_dma(struct uart_8250_port *p)
......
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