]> err.no Git - linux-2.6/blobdiff - crypto/async_tx/async_xor.c
async_tx: remove depend_tx from async_tx_sync_epilog
[linux-2.6] / crypto / async_tx / async_xor.c
index 1fcf45ac81ecefd22ad23fe53aa333ffe2b6efa8..65974c6d3d7a78dbc40e9437b416d5990e04e9a2 100644 (file)
@@ -85,15 +85,17 @@ do_async_xor(struct dma_chan *chan, struct page *dest, struct page **src_list,
                tx = dma->device_prep_dma_xor(chan, dma_dest, &dma_src[src_off],
                                              xor_src_cnt, len, dma_flags);
 
-               if (unlikely(!tx && depend_tx))
-                       dma_wait_for_async_tx(depend_tx);
+               if (unlikely(!tx))
+                       async_tx_quiesce(&depend_tx);
 
                /* spin wait for the preceeding transactions to complete */
-               while (unlikely(!tx))
+               while (unlikely(!tx)) {
+                       dma_async_issue_pending(chan);
                        tx = dma->device_prep_dma_xor(chan, dma_dest,
                                                      &dma_src[src_off],
                                                      xor_src_cnt, len,
                                                      dma_flags);
+               }
 
                async_tx_submit(chan, tx, async_flags, depend_tx, _cb_fn,
                                _cb_param);
@@ -119,7 +121,6 @@ do_async_xor(struct dma_chan *chan, struct page *dest, struct page **src_list,
 static void
 do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset,
            int src_cnt, size_t len, enum async_tx_flags flags,
-           struct dma_async_tx_descriptor *depend_tx,
            dma_async_tx_callback cb_fn, void *cb_param)
 {
        int i;
@@ -148,7 +149,7 @@ do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset,
                src_off += xor_src_cnt;
        }
 
-       async_tx_sync_epilog(flags, depend_tx, cb_fn, cb_param);
+       async_tx_sync_epilog(cb_fn, cb_param);
 }
 
 /**
@@ -199,18 +200,10 @@ async_xor(struct page *dest, struct page **src_list, unsigned int offset,
                }
 
                /* wait for any prerequisite operations */
-               if (depend_tx) {
-                       /* if ack is already set then we cannot be sure
-                        * we are referring to the correct operation
-                        */
-                       BUG_ON(async_tx_test_ack(depend_tx));
-                       if (dma_wait_for_async_tx(depend_tx) == DMA_ERROR)
-                               panic("%s: DMA_ERROR waiting for depend_tx\n",
-                                       __func__);
-               }
+               async_tx_quiesce(&depend_tx);
 
                do_sync_xor(dest, src_list, offset, src_cnt, len,
-                           flags, depend_tx, cb_fn, cb_param);
+                           flags, cb_fn, cb_param);
 
                return NULL;
        }
@@ -267,11 +260,11 @@ async_xor_zero_sum(struct page *dest, struct page **src_list,
                tx = device->device_prep_dma_zero_sum(chan, dma_src, src_cnt,
                                                      len, result,
                                                      dma_prep_flags);
-               if (!tx) {
-                       if (depend_tx)
-                               dma_wait_for_async_tx(depend_tx);
+               if (unlikely(!tx)) {
+                       async_tx_quiesce(&depend_tx);
 
                        while (!tx)
+                               dma_async_issue_pending(chan);
                                tx = device->device_prep_dma_zero_sum(chan,
                                        dma_src, src_cnt, len, result,
                                        dma_prep_flags);
@@ -289,18 +282,11 @@ async_xor_zero_sum(struct page *dest, struct page **src_list,
                tx = async_xor(dest, src_list, offset, src_cnt, len, xor_flags,
                        depend_tx, NULL, NULL);
 
-               if (tx) {
-                       if (dma_wait_for_async_tx(tx) == DMA_ERROR)
-                               panic("%s: DMA_ERROR waiting for tx\n",
-                                       __func__);
-                       async_tx_ack(tx);
-               }
+               async_tx_quiesce(&tx);
 
                *result = page_is_zero(dest, offset, len) ? 0 : 1;
 
-               tx = NULL;
-
-               async_tx_sync_epilog(flags, depend_tx, cb_fn, cb_param);
+               async_tx_sync_epilog(cb_fn, cb_param);
        }
 
        return tx;