aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2014-06-18 05:15:36 -0400
committerVinod Koul <vinod.koul@intel.com>2014-07-15 12:44:28 -0400
commite7637c6c0382485f4d2e20715d058dae6f2b6a7c (patch)
tree613b0b426ca802c840a4f9d4bc395d2aad3c42b1 /drivers/dma
parentf60f141ca5c106c8fa71abe324efb310b96621d1 (diff)
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>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/dw/core.c19
1 files 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)
279 channel_set_bit(dw, CH_EN, dwc->mask); 279 channel_set_bit(dw, CH_EN, dwc->mask);
280} 280}
281 281
282static void dwc_dostart_first_queued(struct dw_dma_chan *dwc)
283{
284 if (list_empty(&dwc->queue))
285 return;
286
287 list_move(dwc->queue.next, &dwc->active_list);
288 dwc_dostart(dwc, dwc_first_active(dwc));
289}
290
282/*----------------------------------------------------------------------*/ 291/*----------------------------------------------------------------------*/
283 292
284static void 293static void
@@ -335,10 +344,7 @@ static void dwc_complete_all(struct dw_dma *dw, struct dw_dma_chan *dwc)
335 * the completed ones. 344 * the completed ones.
336 */ 345 */
337 list_splice_init(&dwc->active_list, &list); 346 list_splice_init(&dwc->active_list, &list);
338 if (!list_empty(&dwc->queue)) { 347 dwc_dostart_first_queued(dwc);
339 list_move(dwc->queue.next, &dwc->active_list);
340 dwc_dostart(dwc, dwc_first_active(dwc));
341 }
342 348
343 spin_unlock_irqrestore(&dwc->lock, flags); 349 spin_unlock_irqrestore(&dwc->lock, flags);
344 350
@@ -467,10 +473,7 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
467 /* Try to continue after resetting the channel... */ 473 /* Try to continue after resetting the channel... */
468 dwc_chan_disable(dw, dwc); 474 dwc_chan_disable(dw, dwc);
469 475
470 if (!list_empty(&dwc->queue)) { 476 dwc_dostart_first_queued(dwc);
471 list_move(dwc->queue.next, &dwc->active_list);
472 dwc_dostart(dwc, dwc_first_active(dwc));
473 }
474 spin_unlock_irqrestore(&dwc->lock, flags); 477 spin_unlock_irqrestore(&dwc->lock, flags);
475} 478}
476 479