diff mbox

[2/6] dma: edma: Check the current decriptor first in tx_status()

Message ID 20140417143249.273350892@linutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Gleixner April 17, 2014, 2:40 p.m. UTC
It's likely that the caller investigates the status of a currently
active descriptor. Make that simple check first and only rumage in the
vchan list if that fails.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/dma/edma.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox

Patch

Index: linux-2.6/drivers/dma/edma.c
===================================================================
--- linux-2.6.orig/drivers/dma/edma.c
+++ linux-2.6/drivers/dma/edma.c
@@ -774,11 +774,10 @@  static enum dma_status edma_tx_status(st
 		return ret;
 
 	spin_lock_irqsave(&echan->vchan.lock, flags);
-	vdesc = vchan_find_desc(&echan->vchan, cookie);
-	if (vdesc)
-		txstate->residue = to_edma_desc(&vdesc->tx)->residue;
-	else if (echan->edesc && echan->edesc->vdesc.tx.cookie == cookie)
+	if (echan->edesc && echan->edesc->vdesc.tx.cookie == cookie)
 		txstate->residue = echan->edesc->residue;
+	else if ((vdesc = vchan_find_desc(&echan->vchan, cookie)))
+		txstate->residue = to_edma_desc(&vdesc->tx)->residue;
 	spin_unlock_irqrestore(&echan->vchan.lock, flags);
 
 	return ret;