All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] dmaengine: tegra-apb: Correct grammar in TX status debug message
@ 2016-06-29 16:08 Jon Hunter
       [not found] ` <1467216519-7200-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Jon Hunter @ 2016-06-29 16:08 UTC (permalink / raw)
  To: Laxman Dewangan, Vinod Koul
  Cc: dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jon Hunter

Correct the grammar in the debug message when no descriptor is found.

Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/dma/tegra20-apb-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index d84b0b88e708..0c7defbeefe7 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -843,7 +843,7 @@ static enum dma_status tegra_dma_tx_status(struct dma_chan *dc,
 		}
 	}
 
-	dev_dbg(tdc2dev(tdc), "cookie %d does not found\n", cookie);
+	dev_dbg(tdc2dev(tdc), "cookie %d not found\n", cookie);
 	spin_unlock_irqrestore(&tdc->lock, flags);
 	return ret;
 }
-- 
2.1.4

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

* [PATCH 2/3] dmaengine: tegra-apb: Remove duplicated residue calculation
       [not found] ` <1467216519-7200-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-06-29 16:08   ` Jon Hunter
       [not found]     ` <1467216519-7200-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2016-06-29 16:08   ` [PATCH 3/3] dmaengine: tegra-apb: Return the actual descriptor status Jon Hunter
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Jon Hunter @ 2016-06-29 16:08 UTC (permalink / raw)
  To: Laxman Dewangan, Vinod Koul
  Cc: dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jon Hunter

The calculation of the DMA residue for the Tegra APB DMA is duplicated
in two places in the tegra_dma_tx_status() function. Remove this
duplicated code by moving calculation to the end of the function and
only calculating if we found a valid descriptor.

Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/dma/tegra20-apb-dma.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index 0c7defbeefe7..6da9e1032236 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -819,13 +819,8 @@ static enum dma_status tegra_dma_tx_status(struct dma_chan *dc,
 	/* Check on wait_ack desc status */
 	list_for_each_entry(dma_desc, &tdc->free_dma_desc, node) {
 		if (dma_desc->txd.cookie == cookie) {
-			residual =  dma_desc->bytes_requested -
-					(dma_desc->bytes_transferred %
-						dma_desc->bytes_requested);
-			dma_set_residue(txstate, residual);
 			ret = dma_desc->dma_status;
-			spin_unlock_irqrestore(&tdc->lock, flags);
-			return ret;
+			goto found;
 		}
 	}
 
@@ -833,17 +828,22 @@ static enum dma_status tegra_dma_tx_status(struct dma_chan *dc,
 	list_for_each_entry(sg_req, &tdc->pending_sg_req, node) {
 		dma_desc = sg_req->dma_desc;
 		if (dma_desc->txd.cookie == cookie) {
-			residual =  dma_desc->bytes_requested -
-					(dma_desc->bytes_transferred %
-						dma_desc->bytes_requested);
-			dma_set_residue(txstate, residual);
 			ret = dma_desc->dma_status;
-			spin_unlock_irqrestore(&tdc->lock, flags);
-			return ret;
+			goto found;
 		}
 	}
 
 	dev_dbg(tdc2dev(tdc), "cookie %d not found\n", cookie);
+	dma_desc = NULL;
+
+found:
+	if (dma_desc) {
+		residual = dma_desc->bytes_requested -
+			   (dma_desc->bytes_transferred %
+			    dma_desc->bytes_requested);
+		dma_set_residue(txstate, residual);
+	}
+
 	spin_unlock_irqrestore(&tdc->lock, flags);
 	return ret;
 }
-- 
2.1.4

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

* [PATCH 3/3] dmaengine: tegra-apb: Return the actual descriptor status
       [not found] ` <1467216519-7200-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2016-06-29 16:08   ` [PATCH 2/3] dmaengine: tegra-apb: Remove duplicated residue calculation Jon Hunter
@ 2016-06-29 16:08   ` Jon Hunter
       [not found]     ` <1467216519-7200-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2016-06-30  3:23   ` [PATCH 1/3] dmaengine: tegra-apb: Correct grammar in TX status debug message Vinod Koul
  2016-07-18  7:17   ` Thierry Reding
  3 siblings, 1 reply; 7+ messages in thread
From: Jon Hunter @ 2016-06-29 16:08 UTC (permalink / raw)
  To: Laxman Dewangan, Vinod Koul
  Cc: dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jon Hunter

Commit 71f7e6cc5500 ('dmaengine: tegra20-apb-dma: Only calculate residue
if txstate exists') changed the tegra_dma_tx_status() function to only
calculate the residue if there is a valid 'txstate' pointer for storing
the residue. Although this makes sense, this changed the behaviour of
the function tegra_dma_tx_status() such that if the pointer 'txstate' is
not valid, then we will return whatever state is returned by
dma_cookie_status() and no longer return the state by looking up the DMA
descriptor and returning it's state.

Please note that dma_cookie_status() will either return DMA_COMPLETE or
DMA_IN_PROGRESS. However, if dma_cookie_status() returns DMA_IN_PROGRESS
the actual status could be DMA_ERROR which will only be seen from
checking the descriptor status. Therefore, even if 'txstate' is not
valid, still check to see if there is a valid descriptor for the cookie
in question and if so return the descriptor state. Finally, ensure the
residue is still not calculated if the 'txstate' is not valid.

Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/dma/tegra20-apb-dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index 6da9e1032236..6ab9eb98588a 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -811,7 +811,7 @@ static enum dma_status tegra_dma_tx_status(struct dma_chan *dc,
 	unsigned int residual;
 
 	ret = dma_cookie_status(dc, cookie, txstate);
-	if (ret == DMA_COMPLETE || !txstate)
+	if (ret == DMA_COMPLETE)
 		return ret;
 
 	spin_lock_irqsave(&tdc->lock, flags);
@@ -837,7 +837,7 @@ static enum dma_status tegra_dma_tx_status(struct dma_chan *dc,
 	dma_desc = NULL;
 
 found:
-	if (dma_desc) {
+	if (dma_desc && txstate) {
 		residual = dma_desc->bytes_requested -
 			   (dma_desc->bytes_transferred %
 			    dma_desc->bytes_requested);
-- 
2.1.4

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

* Re: [PATCH 1/3] dmaengine: tegra-apb: Correct grammar in TX status debug message
       [not found] ` <1467216519-7200-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2016-06-29 16:08   ` [PATCH 2/3] dmaengine: tegra-apb: Remove duplicated residue calculation Jon Hunter
  2016-06-29 16:08   ` [PATCH 3/3] dmaengine: tegra-apb: Return the actual descriptor status Jon Hunter
@ 2016-06-30  3:23   ` Vinod Koul
  2016-07-18  7:17   ` Thierry Reding
  3 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2016-06-30  3:23 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Laxman Dewangan, dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On Wed, Jun 29, 2016 at 05:08:37PM +0100, Jon Hunter wrote:
> Correct the grammar in the debug message when no descriptor is found.

Applied all, thanks

-- 
~Vinod

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

* Re: [PATCH 1/3] dmaengine: tegra-apb: Correct grammar in TX status debug message
       [not found] ` <1467216519-7200-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-06-30  3:23   ` [PATCH 1/3] dmaengine: tegra-apb: Correct grammar in TX status debug message Vinod Koul
@ 2016-07-18  7:17   ` Thierry Reding
  3 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2016-07-18  7:17 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Laxman Dewangan, Vinod Koul, dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

On Wed, Jun 29, 2016 at 05:08:37PM +0100, Jon Hunter wrote:
> Correct the grammar in the debug message when no descriptor is found.
> 
> Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/dma/tegra20-apb-dma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 2/3] dmaengine: tegra-apb: Remove duplicated residue calculation
       [not found]     ` <1467216519-7200-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-07-18  7:17       ` Thierry Reding
  0 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2016-07-18  7:17 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Laxman Dewangan, Vinod Koul, dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 615 bytes --]

On Wed, Jun 29, 2016 at 05:08:38PM +0100, Jon Hunter wrote:
> The calculation of the DMA residue for the Tegra APB DMA is duplicated
> in two places in the tegra_dma_tx_status() function. Remove this
> duplicated code by moving calculation to the end of the function and
> only calculating if we found a valid descriptor.
> 
> Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/dma/tegra20-apb-dma.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)

Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 3/3] dmaengine: tegra-apb: Return the actual descriptor status
       [not found]     ` <1467216519-7200-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-07-18  7:17       ` Thierry Reding
  0 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2016-07-18  7:17 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Laxman Dewangan, Vinod Koul, dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]

On Wed, Jun 29, 2016 at 05:08:39PM +0100, Jon Hunter wrote:
> Commit 71f7e6cc5500 ('dmaengine: tegra20-apb-dma: Only calculate residue
> if txstate exists') changed the tegra_dma_tx_status() function to only
> calculate the residue if there is a valid 'txstate' pointer for storing
> the residue. Although this makes sense, this changed the behaviour of
> the function tegra_dma_tx_status() such that if the pointer 'txstate' is
> not valid, then we will return whatever state is returned by
> dma_cookie_status() and no longer return the state by looking up the DMA
> descriptor and returning it's state.
> 
> Please note that dma_cookie_status() will either return DMA_COMPLETE or
> DMA_IN_PROGRESS. However, if dma_cookie_status() returns DMA_IN_PROGRESS
> the actual status could be DMA_ERROR which will only be seen from
> checking the descriptor status. Therefore, even if 'txstate' is not
> valid, still check to see if there is a valid descriptor for the cookie
> in question and if so return the descriptor state. Finally, ensure the
> residue is still not calculated if the 'txstate' is not valid.
> 
> Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/dma/tegra20-apb-dma.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2016-07-18  7:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-29 16:08 [PATCH 1/3] dmaengine: tegra-apb: Correct grammar in TX status debug message Jon Hunter
     [not found] ` <1467216519-7200-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-29 16:08   ` [PATCH 2/3] dmaengine: tegra-apb: Remove duplicated residue calculation Jon Hunter
     [not found]     ` <1467216519-7200-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-07-18  7:17       ` Thierry Reding
2016-06-29 16:08   ` [PATCH 3/3] dmaengine: tegra-apb: Return the actual descriptor status Jon Hunter
     [not found]     ` <1467216519-7200-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-07-18  7:17       ` Thierry Reding
2016-06-30  3:23   ` [PATCH 1/3] dmaengine: tegra-apb: Correct grammar in TX status debug message Vinod Koul
2016-07-18  7:17   ` Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.