]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/dma/mv_xor.c
DMAENGINE: generic channel status v2
[net-next-2.6.git] / drivers / dma / mv_xor.c
index 3f23eabe09f2076cc05ddc1805129615d1dde6bc..79fb1dea691b9ac8706818e20c33479c8cb97479 100644 (file)
@@ -517,7 +517,7 @@ retry:
                        }
                        alloc_tail->group_head = alloc_start;
                        alloc_tail->async_tx.cookie = -EBUSY;
-                       list_splice(&chain, &alloc_tail->async_tx.tx_list);
+                       list_splice(&chain, &alloc_tail->tx_list);
                        mv_chan->last_used = last_used;
                        mv_desc_clear_next_desc(alloc_start);
                        mv_desc_clear_next_desc(alloc_tail);
@@ -565,14 +565,14 @@ mv_xor_tx_submit(struct dma_async_tx_descriptor *tx)
        cookie = mv_desc_assign_cookie(mv_chan, sw_desc);
 
        if (list_empty(&mv_chan->chain))
-               list_splice_init(&sw_desc->async_tx.tx_list, &mv_chan->chain);
+               list_splice_init(&sw_desc->tx_list, &mv_chan->chain);
        else {
                new_hw_chain = 0;
 
                old_chain_tail = list_entry(mv_chan->chain.prev,
                                            struct mv_xor_desc_slot,
                                            chain_node);
-               list_splice_init(&grp_start->async_tx.tx_list,
+               list_splice_init(&grp_start->tx_list,
                                 &old_chain_tail->chain_node);
 
                if (!mv_can_chain(grp_start))
@@ -632,6 +632,7 @@ static int mv_xor_alloc_chan_resources(struct dma_chan *chan)
                slot->async_tx.tx_submit = mv_xor_tx_submit;
                INIT_LIST_HEAD(&slot->chain_node);
                INIT_LIST_HEAD(&slot->slot_node);
+               INIT_LIST_HEAD(&slot->tx_list);
                hw_desc = (char *) mv_chan->device->dma_desc_pool;
                slot->async_tx.phys =
                        (dma_addr_t) &hw_desc[idx * MV_XOR_SLOT_SIZE];
@@ -808,14 +809,14 @@ static void mv_xor_free_chan_resources(struct dma_chan *chan)
 }
 
 /**
- * mv_xor_is_complete - poll the status of an XOR transaction
+ * mv_xor_status - poll the status of an XOR transaction
  * @chan: XOR channel handle
  * @cookie: XOR transaction identifier
+ * @txstate: XOR transactions state holder (or NULL)
  */
-static enum dma_status mv_xor_is_complete(struct dma_chan *chan,
+static enum dma_status mv_xor_status(struct dma_chan *chan,
                                          dma_cookie_t cookie,
-                                         dma_cookie_t *done,
-                                         dma_cookie_t *used)
+                                         struct dma_tx_state *txstate)
 {
        struct mv_xor_chan *mv_chan = to_mv_xor_chan(chan);
        dma_cookie_t last_used;
@@ -825,10 +826,11 @@ static enum dma_status mv_xor_is_complete(struct dma_chan *chan,
        last_used = chan->cookie;
        last_complete = mv_chan->completed_cookie;
        mv_chan->is_complete_cookie = cookie;
-       if (done)
-               *done = last_complete;
-       if (used)
-               *used = last_used;
+       if (txstate) {
+               txstate->last = last_complete;
+               txstate->used = last_used;
+               txstate->residue = 0;
+       }
 
        ret = dma_async_is_complete(cookie, last_complete, last_used);
        if (ret == DMA_SUCCESS) {
@@ -840,10 +842,11 @@ static enum dma_status mv_xor_is_complete(struct dma_chan *chan,
        last_used = chan->cookie;
        last_complete = mv_chan->completed_cookie;
 
-       if (done)
-               *done = last_complete;
-       if (used)
-               *used = last_used;
+       if (txstate) {
+               txstate->last = last_complete;
+               txstate->used = last_used;
+               txstate->residue = 0;
+       }
 
        return dma_async_is_complete(cookie, last_complete, last_used);
 }
@@ -973,7 +976,7 @@ static int __devinit mv_xor_memcpy_self_test(struct mv_xor_device *device)
        async_tx_ack(tx);
        msleep(1);
 
-       if (mv_xor_is_complete(dma_chan, cookie, NULL, NULL) !=
+       if (mv_xor_status(dma_chan, cookie, NULL) !=
            DMA_SUCCESS) {
                dev_printk(KERN_ERR, dma_chan->device->dev,
                           "Self-test copy timed out, disabling\n");
@@ -1071,7 +1074,7 @@ mv_xor_xor_self_test(struct mv_xor_device *device)
        async_tx_ack(tx);
        msleep(8);
 
-       if (mv_xor_is_complete(dma_chan, cookie, NULL, NULL) !=
+       if (mv_xor_status(dma_chan, cookie, NULL) !=
            DMA_SUCCESS) {
                dev_printk(KERN_ERR, dma_chan->device->dev,
                           "Self-test xor timed out, disabling\n");
@@ -1166,7 +1169,7 @@ static int __devinit mv_xor_probe(struct platform_device *pdev)
        /* set base routines */
        dma_dev->device_alloc_chan_resources = mv_xor_alloc_chan_resources;
        dma_dev->device_free_chan_resources = mv_xor_free_chan_resources;
-       dma_dev->device_is_tx_complete = mv_xor_is_complete;
+       dma_dev->device_tx_status = mv_xor_status;
        dma_dev->device_issue_pending = mv_xor_issue_pending;
        dma_dev->dev = &pdev->dev;