Merge tag 'dmaengine-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw...
[linux-flexiantxendom0-3.2.10.git] / drivers / dma / ioat / dma_v2.c
index 143cb1b..8689576 100644 (file)
@@ -41,6 +41,8 @@
 #include "registers.h"
 #include "hw.h"
 
+#include "../dmaengine.h"
+
 int ioat_ring_alloc_order = 8;
 module_param(ioat_ring_alloc_order, int, 0644);
 MODULE_PARM_DESC(ioat_ring_alloc_order,
@@ -147,8 +149,7 @@ static void __cleanup(struct ioat2_dma_chan *ioat, dma_addr_t phys_complete)
                dump_desc_dbg(ioat, desc);
                if (tx->cookie) {
                        ioat_dma_unmap(chan, tx->flags, desc->len, desc->hw);
-                       chan->completed_cookie = tx->cookie;
-                       tx->cookie = 0;
+                       dma_cookie_complete(tx);
                        if (tx->callback) {
                                tx->callback(tx->callback_param);
                                tx->callback = NULL;
@@ -398,13 +399,9 @@ static dma_cookie_t ioat2_tx_submit_unlock(struct dma_async_tx_descriptor *tx)
        struct dma_chan *c = tx->chan;
        struct ioat2_dma_chan *ioat = to_ioat2_chan(c);
        struct ioat_chan_common *chan = &ioat->base;
-       dma_cookie_t cookie = c->cookie;
+       dma_cookie_t cookie;
 
-       cookie++;
-       if (cookie < 0)
-               cookie = 1;
-       tx->cookie = cookie;
-       c->cookie = cookie;
+       cookie = dma_cookie_assign(tx);
        dev_dbg(to_dev(&ioat->base), "%s: cookie: %d\n", __func__, cookie);
 
        if (!test_and_set_bit(IOAT_COMPLETION_PENDING, &chan->state))