dmaengine: provide helper for setting txstate
Simple conditional struct filler to cut out some duplicated code.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index ee40dbb..e5d4b97 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -909,13 +909,7 @@
last_used = chan->cookie;
last_complete = iop_chan->completed_cookie;
-
- if (txstate) {
- txstate->last = last_complete;
- txstate->used = last_used;
- txstate->residue = 0;
- }
-
+ dma_set_tx_state(txstate, last_complete, last_used, 0);
ret = dma_async_is_complete(cookie, last_complete, last_used);
if (ret == DMA_SUCCESS)
return ret;
@@ -924,12 +918,7 @@
last_used = chan->cookie;
last_complete = iop_chan->completed_cookie;
-
- if (txstate) {
- txstate->last = last_complete;
- txstate->used = last_used;
- txstate->residue = 0;
- }
+ dma_set_tx_state(txstate, last_complete, last_used, 0);
return dma_async_is_complete(cookie, last_complete, last_used);
}