dmaengine: up-level reference counting to the module level
[platform/kernel/linux-arm64.git] / crypto / async_tx / async_tx.c
index e8362c1..43fe4cb 100644 (file)
@@ -72,83 +72,6 @@ void async_tx_issue_pending_all(void)
 }
 EXPORT_SYMBOL_GPL(async_tx_issue_pending_all);
 
-/* dma_wait_for_async_tx - spin wait for a transcation to complete
- * @tx: transaction to wait on
- */
-enum dma_status
-dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
-{
-       enum dma_status status;
-       struct dma_async_tx_descriptor *iter;
-       struct dma_async_tx_descriptor *parent;
-
-       if (!tx)
-               return DMA_SUCCESS;
-
-       /* poll through the dependency chain, return when tx is complete */
-       do {
-               iter = tx;
-
-               /* find the root of the unsubmitted dependency chain */
-               do {
-                       parent = iter->parent;
-                       if (!parent)
-                               break;
-                       else
-                               iter = parent;
-               } while (parent);
-
-               /* there is a small window for ->parent == NULL and
-                * ->cookie == -EBUSY
-                */
-               while (iter->cookie == -EBUSY)
-                       cpu_relax();
-
-               status = dma_sync_wait(iter->chan, iter->cookie);
-       } while (status == DMA_IN_PROGRESS || (iter != tx));
-
-       return status;
-}
-EXPORT_SYMBOL_GPL(dma_wait_for_async_tx);
-
-/* async_tx_run_dependencies - helper routine for dma drivers to process
- *     (start) dependent operations on their target channel
- * @tx: transaction with dependencies
- */
-void
-async_tx_run_dependencies(struct dma_async_tx_descriptor *tx)
-{
-       struct dma_async_tx_descriptor *next = tx->next;
-       struct dma_chan *chan;
-
-       if (!next)
-               return;
-
-       tx->next = NULL;
-       chan = next->chan;
-
-       /* keep submitting up until a channel switch is detected
-        * in that case we will be called again as a result of
-        * processing the interrupt from async_tx_channel_switch
-        */
-       while (next && next->chan == chan) {
-               struct dma_async_tx_descriptor *_next;
-
-               spin_lock_bh(&next->lock);
-               next->parent = NULL;
-               _next = next->next;
-               if (_next && _next->chan == chan)
-                       next->next = NULL;
-               spin_unlock_bh(&next->lock);
-
-               next->tx_submit(next);
-               next = _next;
-       }
-
-       chan->device->device_issue_pending(chan);
-}
-EXPORT_SYMBOL_GPL(async_tx_run_dependencies);
-
 static void
 free_dma_chan_ref(struct rcu_head *rcu)
 {
@@ -275,8 +198,6 @@ dma_channel_add_remove(struct dma_client *client,
                /* add the channel to the generic management list */
                master_ref = kmalloc(sizeof(*master_ref), GFP_KERNEL);
                if (master_ref) {
-                       /* keep a reference until async_tx is unloaded */
-                       dma_chan_get(chan);
                        init_dma_chan_ref(master_ref, chan);
                        spin_lock_irqsave(&async_tx_lock, flags);
                        list_add_tail_rcu(&master_ref->node,
@@ -298,8 +219,6 @@ dma_channel_add_remove(struct dma_client *client,
                spin_lock_irqsave(&async_tx_lock, flags);
                list_for_each_entry(ref, &async_tx_master_list, node)
                        if (ref->chan == chan) {
-                               /* permit backing devices to go away */
-                               dma_chan_put(ref->chan);
                                list_del_rcu(&ref->node);
                                call_rcu(&ref->rcu, free_dma_chan_ref);
                                found = 1;