* [PATCH] tty: serial: imx: use the sg count from dma_map_sg
@ 2019-11-07 3:02 Peng Fan
2019-11-07 6:37 ` Peng Fan
0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan @ 2019-11-07 3:02 UTC (permalink / raw)
To: gregkh, jslaby, shawnguo, festevam
Cc: dl-linux-imx, linux-serial, linux-kernel, Andy Duan, kernel,
linux-arm-kernel, Peng Fan
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] tty: serial: imx: use the sg count from dma_map_sg
2019-11-07 3:02 [PATCH] tty: serial: imx: use the sg count from dma_map_sg Peng Fan
@ 2019-11-07 6:37 ` Peng Fan
0 siblings, 0 replies; 2+ messages in thread
From: Peng Fan @ 2019-11-07 6:37 UTC (permalink / raw)
To: gregkh, jslaby, shawnguo, festevam
Cc: dl-linux-imx, linux-serial, linux-kernel, Andy Duan, kernel,
linux-arm-kernel
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-07 6:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 3:02 [PATCH] tty: serial: imx: use the sg count from dma_map_sg Peng Fan
2019-11-07 6:37 ` Peng Fan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).