]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
dw_dmac: Move single descriptor from dwc->queue to dwc->active_list in dwc_complete_all
authorViresh Kumar <viresh.kumar@st.com>
Thu, 3 Mar 2011 10:17:16 +0000 (15:47 +0530)
committerVinod Koul <vinod.koul@intel.com>
Sun, 6 Mar 2011 19:42:27 +0000 (01:12 +0530)
dwc_complete_all and other routines was removing all descriptors from dwc->queue
and pushing them to dwc->active_list. Only one was required to be removed. Also
we are calling dwc_dostart, once list is fixed.

Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/dw_dmac.c

index 064a1830a76b1012d91a4550c818f3f3e5743aa2..942b50f57f21ea8407f20f52440a1d3ee3add15f 100644 (file)
@@ -87,11 +87,6 @@ static struct dw_desc *dwc_first_active(struct dw_dma_chan *dwc)
        return list_entry(dwc->active_list.next, struct dw_desc, desc_node);
 }
 
-static struct dw_desc *dwc_first_queued(struct dw_dma_chan *dwc)
-{
-       return list_entry(dwc->queue.next, struct dw_desc, desc_node);
-}
-
 static struct dw_desc *dwc_desc_get(struct dw_dma_chan *dwc)
 {
        struct dw_desc *desc, *_desc;
@@ -262,10 +257,11 @@ static void dwc_complete_all(struct dw_dma *dw, struct dw_dma_chan *dwc)
         * Submit queued descriptors ASAP, i.e. before we go through
         * the completed ones.
         */
-       if (!list_empty(&dwc->queue))
-               dwc_dostart(dwc, dwc_first_queued(dwc));
        list_splice_init(&dwc->active_list, &list);
-       list_splice_init(&dwc->queue, &dwc->active_list);
+       if (!list_empty(&dwc->queue)) {
+               list_move(dwc->queue.next, &dwc->active_list);
+               dwc_dostart(dwc, dwc_first_active(dwc));
+       }
 
        list_for_each_entry_safe(desc, _desc, &list, desc_node)
                dwc_descriptor_complete(dwc, desc);
@@ -325,8 +321,8 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
                cpu_relax();
 
        if (!list_empty(&dwc->queue)) {
-               dwc_dostart(dwc, dwc_first_queued(dwc));
-               list_splice_init(&dwc->queue, &dwc->active_list);
+               list_move(dwc->queue.next, &dwc->active_list);
+               dwc_dostart(dwc, dwc_first_active(dwc));
        }
 }
 
@@ -352,7 +348,7 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
         */
        bad_desc = dwc_first_active(dwc);
        list_del_init(&bad_desc->desc_node);
-       list_splice_init(&dwc->queue, dwc->active_list.prev);
+       list_move(dwc->queue.next, dwc->active_list.prev);
 
        /* Clear the error flag and try to restart the controller */
        dma_writel(dw, CLEAR.ERROR, dwc->mask);
@@ -547,8 +543,8 @@ static dma_cookie_t dwc_tx_submit(struct dma_async_tx_descriptor *tx)
        if (list_empty(&dwc->active_list)) {
                dev_vdbg(chan2dev(tx->chan), "tx_submit: started %u\n",
                                desc->txd.cookie);
-               dwc_dostart(dwc, desc);
                list_add_tail(&desc->desc_node, &dwc->active_list);
+               dwc_dostart(dwc, dwc_first_active(dwc));
        } else {
                dev_vdbg(chan2dev(tx->chan), "tx_submit: queued %u\n",
                                desc->txd.cookie);