mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] serial: tegra: update tx_circular buffer only when TX_DMA is in progress
@ 2014-06-06 11:18 Laxman Dewangan
  2014-06-06 11:18 ` [PATCH 2/2] serial: tegra: ack the rx dma desc after transfer terminated Laxman Dewangan
  0 siblings, 1 reply; 2+ messages in thread
From: Laxman Dewangan @ 2014-06-06 11:18 UTC (permalink / raw)
  To: gregkh
  Cc: swarren, linux-serial, linux-tegra, linux-kernel,
	Pradeep Goudagunta, Laxman Dewangan

From: Pradeep Goudagunta <pgoudagunta@nvidia.com>

When channel is require to stop transmit then update the Tx circular
buffer only when DMA based transfer is in progress. If there is no
DMA based transfer then no need to update the Tx buffer.

Signed-off-by: Pradeep Goudagunta <pgoudagunta@nvidia.com>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/tty/serial/serial-tegra.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index d5c2a28..117d8d1 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -482,6 +482,9 @@ static void tegra_uart_stop_tx(struct uart_port *u)
 	struct dma_tx_state state;
 	int count;
 
+	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);
 	count = tup->tx_bytes_requested - state.residue;
-- 
1.8.1.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] serial: tegra: ack the rx dma desc after transfer terminated
  2014-06-06 11:18 [PATCH 1/2] serial: tegra: update tx_circular buffer only when TX_DMA is in progress Laxman Dewangan
@ 2014-06-06 11:18 ` Laxman Dewangan
  0 siblings, 0 replies; 2+ messages in thread
From: Laxman Dewangan @ 2014-06-06 11:18 UTC (permalink / raw)
  To: gregkh
  Cc: swarren, linux-serial, linux-tegra, linux-kernel,
	Pradeep Goudagunta, Laxman Dewangan

From: Pradeep Goudagunta <pgoudagunta@nvidia.com>

The Rx dma descriptor allocated without the DMA_ACK flags so that
once after tarnsfer done or terminated, client can ack the descriptor
to free it for later use.

If the Rx DMA is terminated for some reason then rx-dma descriptor
is not getting acked which causes the memory leak and list of usage
desc to grow continuously.

Hence, acknowledge the rx-dma descriptor once transfer is terminated
to avoid memory leak and desc list to grow.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/tty/serial/serial-tegra.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index 117d8d1..53d7c31 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -602,6 +602,7 @@ static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup,
 
 	dmaengine_terminate_all(tup->rx_dma_chan);
 	dmaengine_tx_status(tup->rx_dma_chan,  tup->rx_cookie, &state);
+	async_tx_ack(tup->rx_dma_desc);
 	count = tup->rx_bytes_requested - state.residue;
 
 	/* If we are here, DMA is stopped */
-- 
1.8.1.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-06 11:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-06 11:18 [PATCH 1/2] serial: tegra: update tx_circular buffer only when TX_DMA is in progress Laxman Dewangan
2014-06-06 11:18 ` [PATCH 2/2] serial: tegra: ack the rx dma desc after transfer terminated Laxman Dewangan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®