diff options
-rw-r--r-- | drivers/dma/ti/edma.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c index f7555d78ff9e..54895112ba59 100644 --- a/drivers/dma/ti/edma.c +++ b/drivers/dma/ti/edma.c | |||
@@ -1832,7 +1832,6 @@ static enum dma_status edma_tx_status(struct dma_chan *chan, | |||
1832 | struct dma_tx_state *txstate) | 1832 | struct dma_tx_state *txstate) |
1833 | { | 1833 | { |
1834 | struct edma_chan *echan = to_edma_chan(chan); | 1834 | struct edma_chan *echan = to_edma_chan(chan); |
1835 | struct virt_dma_desc *vdesc; | ||
1836 | struct dma_tx_state txstate_tmp; | 1835 | struct dma_tx_state txstate_tmp; |
1837 | enum dma_status ret; | 1836 | enum dma_status ret; |
1838 | unsigned long flags; | 1837 | unsigned long flags; |
@@ -1846,12 +1845,18 @@ static enum dma_status edma_tx_status(struct dma_chan *chan, | |||
1846 | if (!txstate) | 1845 | if (!txstate) |
1847 | txstate = &txstate_tmp; | 1846 | txstate = &txstate_tmp; |
1848 | 1847 | ||
1849 | txstate->residue = 0; | ||
1850 | spin_lock_irqsave(&echan->vchan.lock, flags); | 1848 | spin_lock_irqsave(&echan->vchan.lock, flags); |
1851 | if (echan->edesc && echan->edesc->vdesc.tx.cookie == cookie) | 1849 | if (echan->edesc && echan->edesc->vdesc.tx.cookie == cookie) { |
1852 | txstate->residue = edma_residue(echan->edesc); | 1850 | txstate->residue = edma_residue(echan->edesc); |
1853 | else if ((vdesc = vchan_find_desc(&echan->vchan, cookie))) | 1851 | } else { |
1854 | txstate->residue = to_edma_desc(&vdesc->tx)->residue; | 1852 | struct virt_dma_desc *vdesc = vchan_find_desc(&echan->vchan, |
1853 | cookie); | ||
1854 | |||
1855 | if (vdesc) | ||
1856 | txstate->residue = to_edma_desc(&vdesc->tx)->residue; | ||
1857 | else | ||
1858 | txstate->residue = 0; | ||
1859 | } | ||
1855 | 1860 | ||
1856 | /* | 1861 | /* |
1857 | * Mark the cookie completed if the residue is 0 for non cyclic | 1862 | * Mark the cookie completed if the residue is 0 for non cyclic |