dmaengine: dw: introduce dwc_dostart_first_queued() helper

This change “dmaengine: dw: introduce dwc_dostart_first_queued() helper” (commit e7637c6) in Linux kernel is authored by Andy Shevchenko <andriy.shevchenko [at] linux.intel.com> on Wed Jun 18 12:15:36 2014 +0300.

Description of "dmaengine: dw: introduce dwc_dostart_first_queued() helper"

The change “dmaengine: dw: introduce dwc_dostart_first_queued() helper” introduces changes as follows.

dmaengine: dw: introduce dwc_dostart_first_queued() helper

We have a duplicate code which starts first descriptor in the queue. Let's make
this as a separate helper that can be used in future as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

Linux kernel releases containing commit e7637c6

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "dmaengine: dw: introduce dwc_dostart_first_queued() helper"

There are 19 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/dma/dw/core.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
 
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index a27ded53ab4f..5ddf5e4c1222 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -279,6 +279,15 @@ static void dwc_dostart(struct dw_dma_chan *dwc, struct dw_desc *first)
 	channel_set_bit(dw, CH_EN, dwc->mask);
 }
 
+static void dwc_dostart_first_queued(struct dw_dma_chan *dwc)
+{
+	if (list_empty(&dwc->queue))
+		return;
+
+	list_move(dwc->queue.next, &dwc->active_list);
+	dwc_dostart(dwc, dwc_first_active(dwc));
+}
+
 /*----------------------------------------------------------------------*/
 
 static void
@@ -335,10 +344,7 @@ static void dwc_complete_all(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	 * the completed ones.
 	 */
 	list_splice_init(&dwc->active_list, &list);
-	if (!list_empty(&dwc->queue)) {
-		list_move(dwc->queue.next, &dwc->active_list);
-		dwc_dostart(dwc, dwc_first_active(dwc));
-	}
+	dwc_dostart_first_queued(dwc);
 
 	spin_unlock_irqrestore(&dwc->lock, flags);
 
@@ -467,10 +473,7 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	/* Try to continue after resetting the channel... */
 	dwc_chan_disable(dw, dwc);
 
-	if (!list_empty(&dwc->queue)) {
-		list_move(dwc->queue.next, &dwc->active_list);
-		dwc_dostart(dwc, dwc_first_active(dwc));
-	}
+	dwc_dostart_first_queued(dwc);
 	spin_unlock_irqrestore(&dwc->lock, flags);
 }
 

The commit for this change in Linux stable tree is e7637c6 (patch).

Last modified: 2020/02/10