aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/async_tx/async_tx.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-07-17 20:59:55 -0400
committerDan Williams <dan.j.williams@intel.com>2008-07-17 20:59:55 -0400
commitd2c52b7983b95bb3fc2a784e479f832f142d4523 (patch)
tree7bc37e7438cee523496674adcd97034df764af47 /crypto/async_tx/async_tx.c
parent669ab0b210f9bd15d94d4d6a49ae13366a85e4da (diff)
async_tx: export async_tx_quiesce
Replace open coded "wait and acknowledge" instances with async_tx_quiesce. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'crypto/async_tx/async_tx.c')
-rw-r--r--crypto/async_tx/async_tx.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/crypto/async_tx/async_tx.c b/crypto/async_tx/async_tx.c
index 9325c61208a0..78a61e7f631a 100644
--- a/crypto/async_tx/async_tx.c
+++ b/crypto/async_tx/async_tx.c
@@ -607,15 +607,7 @@ async_trigger_callback(enum async_tx_flags flags,
607 pr_debug("%s: (sync)\n", __func__); 607 pr_debug("%s: (sync)\n", __func__);
608 608
609 /* wait for any prerequisite operations */ 609 /* wait for any prerequisite operations */
610 if (depend_tx) { 610 async_tx_quiesce(&depend_tx);
611 /* if ack is already set then we cannot be sure
612 * we are referring to the correct operation
613 */
614 BUG_ON(async_tx_test_ack(depend_tx));
615 if (dma_wait_for_async_tx(depend_tx) == DMA_ERROR)
616 panic("%s: DMA_ERROR waiting for depend_tx\n",
617 __func__);
618 }
619 611
620 async_tx_sync_epilog(flags, depend_tx, cb_fn, cb_param); 612 async_tx_sync_epilog(flags, depend_tx, cb_fn, cb_param);
621 } 613 }
@@ -624,6 +616,25 @@ async_trigger_callback(enum async_tx_flags flags,
624} 616}
625EXPORT_SYMBOL_GPL(async_trigger_callback); 617EXPORT_SYMBOL_GPL(async_trigger_callback);
626 618
619/**
620 * async_tx_quiesce - ensure tx is complete and freeable upon return
621 * @tx - transaction to quiesce
622 */
623void async_tx_quiesce(struct dma_async_tx_descriptor **tx)
624{
625 if (*tx) {
626 /* if ack is already set then we cannot be sure
627 * we are referring to the correct operation
628 */
629 BUG_ON(async_tx_test_ack(*tx));
630 if (dma_wait_for_async_tx(*tx) == DMA_ERROR)
631 panic("DMA_ERROR waiting for transaction\n");
632 async_tx_ack(*tx);
633 *tx = NULL;
634 }
635}
636EXPORT_SYMBOL_GPL(async_tx_quiesce);
637
627module_init(async_tx_init); 638module_init(async_tx_init);
628module_exit(async_tx_exit); 639module_exit(async_tx_exit);
629 640