public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: Kartik <kkartik@nvidia.com>,
	ldewangan@nvidia.com, gregkh@linuxfoundation.org,
	jirislaby@kernel.org, thierry.reding@gmail.com,
	swarren@nvidia.com, akhilrajeev@nvidia.com,
	linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] serial: tegra: read DMA status before terminating
Date: Tue, 18 Oct 2022 14:18:49 +0100	[thread overview]
Message-ID: <5935afbd-ec39-21f8-1585-57a932261271@nvidia.com> (raw)
In-Reply-To: <1666074311-12764-1-git-send-email-kkartik@nvidia.com>


On 18/10/2022 07:25, 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(-)
> 
> 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);

The change looks fine to me, but on further review of other similar 
drivers I see that they pause first ...

  dmaengine_pause(tup->tx_dma_chan);
  dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
  dmaengine_terminate_all(tup->tx_dma_chan);

This makes sense so that when we calculate the amount of the data 
transferred we get the exact amount. Can we add a pause while we are at it?

Thanks!
Jon

-- 
nvpublic

  parent reply	other threads:[~2022-10-18 13:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18  6:25 [PATCH] serial: tegra: read DMA status before terminating Kartik
2022-10-18  6:25 ` Kartik
2022-10-18  6:38   ` Greg KH
2022-10-18  6:55     ` Kartik
2022-10-18  7:02       ` Greg KH
2022-10-18  7:21         ` Kartik
2022-10-18 13:18 ` Jon Hunter [this message]
2022-10-18 13:33   ` Kartik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5935afbd-ec39-21f8-1585-57a932261271@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=akhilrajeev@nvidia.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=kkartik@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=swarren@nvidia.com \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox