diff options
author | Sebastian Reichel <sebastian.reichel@collabora.co.uk> | 2018-05-08 00:36:10 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-14 14:48:28 +0300 |
commit | 7722c24091c0fcd5041b12d4493064bdf8477098 (patch) | |
tree | f135b12d317e5546c324dbe06f09f98b5eff6ea3 /drivers/tty/serial | |
parent | 676a31d8cb2e71e141318e175a6d2496112532f7 (diff) | |
download | linux-7722c24091c0fcd5041b12d4493064bdf8477098.tar.xz |
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>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r-- | drivers/tty/serial/imx.c | 12 |
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) u32 ucr1, ucr2; if (sport->dma_is_enabled) { - sport->dma_is_rxing = 0; - sport->dma_is_txing = 0; dmaengine_terminate_sync(sport->dma_chan_tx); + if (sport->dma_is_txing) { + dma_unmap_sg(sport->port.dev, &sport->tx_sgl[0], + sport->dma_tx_nents, DMA_TO_DEVICE); + sport->dma_is_txing = 0; + } dmaengine_terminate_sync(sport->dma_chan_rx); + if (sport->dma_is_rxing) { + dma_unmap_sg(sport->port.dev, &sport->rx_sgl, + 1, DMA_FROM_DEVICE); + sport->dma_is_rxing = 0; + } spin_lock_irqsave(&sport->port.lock, flags); imx_uart_stop_tx(port); |