dmaengine: consolidate assignment of DMA cookies
[linux-2.6-block.git] / drivers / dma / ipu / ipu_idmac.c
index 0fcff6508fb1c2b14079242400291982574881bc..d4620c53fd2d3518ab0b31ee9003c728cf8235d2 100644 (file)
@@ -867,14 +867,7 @@ static dma_cookie_t idmac_tx_submit(struct dma_async_tx_descriptor *tx)
 
        dev_dbg(dev, "Submitting sg %p\n", &desc->sg[0]);
 
-       cookie = ichan->dma_chan.cookie;
-
-       if (++cookie < 0)
-               cookie = 1;
-
-       /* from dmaengine.h: "last cookie value returned to client" */
-       ichan->dma_chan.cookie = cookie;
-       tx->cookie = cookie;
+       cookie = dma_cookie_assign(tx);
 
        /* ipu->lock can be taken under ichan->lock, but not v.v. */
        spin_lock_irqsave(&ichan->lock, flags);