dmaengine: cppi41: fix cppi41_dma_tx_status() logic
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 16 Mar 2017 14:18:44 +0000 (16:18 +0200)
committerVinod Koul <vinod.koul@intel.com>
Mon, 27 Mar 2017 05:19:34 +0000 (10:49 +0530)
It makes sense to set residue when channel is in progress. Otherwise it
should be 0 since transfer is completed. Meanwhile this patch doesn't
prevent to set residue value anyway.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/cppi41.c

index 675de6a..a583c64 100644 (file)
@@ -420,11 +420,9 @@ static enum dma_status cppi41_dma_tx_status(struct dma_chan *chan,
        struct cppi41_channel *c = to_cpp41_chan(chan);
        enum dma_status ret;
 
-       /* lock */
        ret = dma_cookie_status(chan, cookie, txstate);
-       if (txstate && ret == DMA_COMPLETE)
-               txstate->residue = c->residue;
-       /* unlock */
+
+       dma_set_residue(txstate, c->residue);
 
        return ret;
 }