aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorDirk Behme <dirk.behme@de.bosch.com>2014-12-09 04:11:27 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-09 17:23:07 -0500
commit82e86ae941194e6b6278ff67aad257b018e0684f (patch)
tree9a9b4b80400cb3de2f8d58750f78f93a566068f0 /drivers/tty
parent2464982174a1886b56b445b0503b331008a626fe (diff)
serial: imx: unmap scatter gather list in imx_flush_buffer
First, reformat the code to exit immediately. This allows us to add more code in more readable format. In case the TX DMA was still running, remove and disable it's resources. Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/imx.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index b4cf24c64a15..952730ab9067 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1250,10 +1250,17 @@ static void imx_shutdown(struct uart_port *port)
1250static void imx_flush_buffer(struct uart_port *port) 1250static void imx_flush_buffer(struct uart_port *port)
1251{ 1251{
1252 struct imx_port *sport = (struct imx_port *)port; 1252 struct imx_port *sport = (struct imx_port *)port;
1253 struct scatterlist *sgl = &sport->tx_sgl[0];
1253 1254
1254 if (sport->dma_is_enabled) { 1255 if (!sport->dma_chan_tx)
1255 sport->tx_bytes = 0; 1256 return;
1256 dmaengine_terminate_all(sport->dma_chan_tx); 1257
1258 sport->tx_bytes = 0;
1259 dmaengine_terminate_all(sport->dma_chan_tx);
1260 if (sport->dma_is_txing) {
1261 dma_unmap_sg(sport->port.dev, sgl, sport->dma_tx_nents,
1262 DMA_TO_DEVICE);
1263 sport->dma_is_txing = false;
1257 } 1264 }
1258} 1265}
1259 1266