diff mbox series

tty: serial: imx: use the sg count from dma_map_sg

Message ID 1573095656-749-1-git-send-email-peng.fan@nxp.com (mailing list archive)
State New, archived
Headers show
Series tty: serial: imx: use the sg count from dma_map_sg | expand

Commit Message

Peng Fan Nov. 7, 2019, 3:02 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>

The dmaengine_prep_slave_sg needs to use sg count returned
by dma_map_sg, not use sport->dma_tx_nents, because the return
value of dma_map_sg is not always same with "nents".

And update sport->dma_tx_nents with value from dma_map_sg to avoid
modifing dma_unmap_sg

Fixes: b4cdc8f61beb("serial: imx: add DMA support for imx6q")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/tty/serial/imx.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Peng Fan Nov. 7, 2019, 6:37 a.m. UTC | #1
> Subject: [PATCH] tty: serial: imx: use the sg count from dma_map_sg

Ignore this patch. Wrong fix, will have V2.

Thanks,
Peng.

> 
> From: Peng Fan <peng.fan@nxp.com>
> 
> The dmaengine_prep_slave_sg needs to use sg count returned by
> dma_map_sg, not use sport->dma_tx_nents, because the return value of
> dma_map_sg is not always same with "nents".
> 
> And update sport->dma_tx_nents with value from dma_map_sg to avoid
> modifing dma_unmap_sg
> 
> Fixes: b4cdc8f61beb("serial: imx: add DMA support for imx6q")
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/tty/serial/imx.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index
> 87c58f9f6390..bda7f59ec60e 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -619,6 +619,9 @@ static void imx_uart_dma_tx(struct imx_port *sport)
>  		dev_err(dev, "DMA mapping error for TX.\n");
>  		return;
>  	}
> +
> +	sport->dma_tx_nents = ret;
> +
>  	desc = dmaengine_prep_slave_sg(chan, sgl, sport->dma_tx_nents,
>  					DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT);
>  	if (!desc) {
> --
> 2.16.4
diff mbox series

Patch

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 87c58f9f6390..bda7f59ec60e 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -619,6 +619,9 @@  static void imx_uart_dma_tx(struct imx_port *sport)
 		dev_err(dev, "DMA mapping error for TX.\n");
 		return;
 	}
+
+	sport->dma_tx_nents = ret;
+
 	desc = dmaengine_prep_slave_sg(chan, sgl, sport->dma_tx_nents,
 					DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT);
 	if (!desc) {