serial: tegra: read DMA status before terminating

Message ID 1666074311-12764-2-git-send-email-kkartik@nvidia.com
State New
Headers
Series serial: tegra: read DMA status before terminating |

Commit Message

Kartik Rajput Oct. 18, 2022, 6:25 a.m. UTC
  To get the valid data, read DMA status before terminating the DMA. As
dmaengine_terminate_all() deletes the DMA desc.

Fixes: e9ea096dd225 ("serial: tegra: add serial driver")

Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Signed-off-by: Kartik <kkartik@nvidia.com>
---
 drivers/tty/serial/serial-tegra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Greg KH Oct. 18, 2022, 6:38 a.m. UTC | #1
On Tue, Oct 18, 2022 at 11:55:11AM +0530, Kartik wrote:
> To get the valid data, read DMA status before terminating the DMA. As
> dmaengine_terminate_all() deletes the DMA desc.
> 
> Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
> 
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> Signed-off-by: Kartik <kkartik@nvidia.com>
> ---
>  drivers/tty/serial/serial-tegra.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Why send this twice?

confused,

greg k-h
  
Kartik Rajput Oct. 18, 2022, 6:55 a.m. UTC | #2
On Tue, Oct 18, 2022 at 12:08, Greg KH wrote:
> Why send this twice?
> 
> confused,

Hi Greg,

I made a mistake in my "git send-email" and the patch got posted twice.

Regards,
Kartik
  
Greg KH Oct. 18, 2022, 7:02 a.m. UTC | #3
On Tue, Oct 18, 2022 at 12:25:16PM +0530, Kartik wrote:
> On Tue, Oct 18, 2022 at 12:08, Greg KH wrote:
> > Why send this twice?
> > 
> > confused,
> 
> Hi Greg,
> 
> I made a mistake in my "git send-email" and the patch got posted twice.

So which one is correct?
  
Kartik Rajput Oct. 18, 2022, 7:21 a.m. UTC | #4
On Tue, Oct 18, 2022 at 12:32, Greg KH wrote:
> So which one is correct?
They are basically the same patch. I goofed up while sending it.
Please ignore the previous patch.

Regards,
Kartik
  

Patch

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index b7170cb9a544..2779b4491f02 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -619,8 +619,8 @@  static void tegra_uart_stop_tx(struct uart_port *u)
 	if (tup->tx_in_progress != TEGRA_UART_TX_DMA)
 		return;
 
-	dmaengine_terminate_all(tup->tx_dma_chan);
 	dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
+	dmaengine_terminate_all(tup->tx_dma_chan);
 	count = tup->tx_bytes_requested - state.residue;
 	async_tx_ack(tup->tx_dma_desc);
 	uart_xmit_advance(&tup->uport, count);
@@ -763,8 +763,8 @@  static void tegra_uart_terminate_rx_dma(struct tegra_uart_port *tup)
 		return;
 	}
 
-	dmaengine_terminate_all(tup->rx_dma_chan);
 	dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state);
+	dmaengine_terminate_all(tup->rx_dma_chan);
 
 	tegra_uart_rx_buffer_push(tup, state.residue);
 	tup->rx_dma_active = false;