aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-10-22 06:14:04 -0400
committerVinod Koul <vinod.koul@intel.com>2013-11-12 03:58:24 -0500
commit706ff628f0669f28e370d2ad30672e5032dc64b2 (patch)
treedcea40f3a3b086e03c7c64680873f0b9ef84bc16 /drivers/dma
parentf8964968ab841cb28b0999f346ee3c2491076257 (diff)
dma: cppi41: use cppi41_pop_desc() where possible
Use cppi41_pop_desc() when appropriate instead of open-coding the same functionality again. That makes the code more readable. The function has to be moved some lines up for this change. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/cppi41.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
index 7a90317d2e7d..2500f60393f4 100644
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -266,6 +266,15 @@ static u32 pd_trans_len(u32 val)
266 return val & ((1 << (DESC_LENGTH_BITS_NUM + 1)) - 1); 266 return val & ((1 << (DESC_LENGTH_BITS_NUM + 1)) - 1);
267} 267}
268 268
269static u32 cppi41_pop_desc(struct cppi41_dd *cdd, unsigned queue_num)
270{
271 u32 desc;
272
273 desc = cppi_readl(cdd->qmgr_mem + QMGR_QUEUE_D(queue_num));
274 desc &= ~0x1f;
275 return desc;
276}
277
269static irqreturn_t cppi41_irq(int irq, void *data) 278static irqreturn_t cppi41_irq(int irq, void *data)
270{ 279{
271 struct cppi41_dd *cdd = data; 280 struct cppi41_dd *cdd = data;
@@ -303,8 +312,7 @@ static irqreturn_t cppi41_irq(int irq, void *data)
303 q_num = __fls(val); 312 q_num = __fls(val);
304 val &= ~(1 << q_num); 313 val &= ~(1 << q_num);
305 q_num += 32 * i; 314 q_num += 32 * i;
306 desc = cppi_readl(cdd->qmgr_mem + QMGR_QUEUE_D(q_num)); 315 desc = cppi41_pop_desc(cdd, q_num);
307 desc &= ~0x1f;
308 c = desc_to_chan(cdd, desc); 316 c = desc_to_chan(cdd, desc);
309 if (WARN_ON(!c)) { 317 if (WARN_ON(!c)) {
310 pr_err("%s() q %d desc %08x\n", __func__, 318 pr_err("%s() q %d desc %08x\n", __func__,
@@ -520,15 +528,6 @@ static void cppi41_compute_td_desc(struct cppi41_desc *d)
520 d->pd0 = DESC_TYPE_TEARD << DESC_TYPE; 528 d->pd0 = DESC_TYPE_TEARD << DESC_TYPE;
521} 529}
522 530
523static u32 cppi41_pop_desc(struct cppi41_dd *cdd, unsigned queue_num)
524{
525 u32 desc;
526
527 desc = cppi_readl(cdd->qmgr_mem + QMGR_QUEUE_D(queue_num));
528 desc &= ~0x1f;
529 return desc;
530}
531
532static int cppi41_tear_down_chan(struct cppi41_channel *c) 531static int cppi41_tear_down_chan(struct cppi41_channel *c)
533{ 532{
534 struct cppi41_dd *cdd = c->cdd; 533 struct cppi41_dd *cdd = c->cdd;
@@ -612,7 +611,7 @@ static int cppi41_tear_down_chan(struct cppi41_channel *c)
612 611
613 WARN_ON(!c->td_retry); 612 WARN_ON(!c->td_retry);
614 if (!c->td_desc_seen) { 613 if (!c->td_desc_seen) {
615 desc_phys = cppi_readl(cdd->qmgr_mem + QMGR_QUEUE_D(c->q_num)); 614 desc_phys = cppi41_pop_desc(cdd, c->q_num);
616 WARN_ON(!desc_phys); 615 WARN_ON(!desc_phys);
617 } 616 }
618 617