aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sebastian.reichel@collabora.co.uk>2018-05-07 17:36:10 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-14 07:48:28 -0400
commit7722c24091c0fcd5041b12d4493064bdf8477098 (patch)
treef135b12d317e5546c324dbe06f09f98b5eff6ea3
parent676a31d8cb2e71e141318e175a6d2496112532f7 (diff)
serial: imx: dma_unmap_sg buffers on shutdown
This properly unmaps DMA SG on device shutdown. Reported-by: Nandor Han <nandor.han@ge.com> Suggested-by: Nandor Han <nandor.han@ge.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/imx.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 42a5edd1e0f9..80bed82e0e0e 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1425,10 +1425,18 @@ static void imx_uart_shutdown(struct uart_port *port)
1425 u32 ucr1, ucr2; 1425 u32 ucr1, ucr2;
1426 1426
1427 if (sport->dma_is_enabled) { 1427 if (sport->dma_is_enabled) {
1428 sport->dma_is_rxing = 0;
1429 sport->dma_is_txing = 0;
1430 dmaengine_terminate_sync(sport->dma_chan_tx); 1428 dmaengine_terminate_sync(sport->dma_chan_tx);
1429 if (sport->dma_is_txing) {
1430 dma_unmap_sg(sport->port.dev, &sport->tx_sgl[0],
1431 sport->dma_tx_nents, DMA_TO_DEVICE);
1432 sport->dma_is_txing = 0;
1433 }
1431 dmaengine_terminate_sync(sport->dma_chan_rx); 1434 dmaengine_terminate_sync(sport->dma_chan_rx);
1435 if (sport->dma_is_rxing) {
1436 dma_unmap_sg(sport->port.dev, &sport->rx_sgl,
1437 1, DMA_FROM_DEVICE);
1438 sport->dma_is_rxing = 0;
1439 }
1432 1440
1433 spin_lock_irqsave(&sport->port.lock, flags); 1441 spin_lock_irqsave(&sport->port.lock, flags);
1434 imx_uart_stop_tx(port); 1442 imx_uart_stop_tx(port);