aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2010-10-06 04:20:37 -0400
committerDan Williams <dan.j.williams@intel.com>2010-10-07 17:54:55 -0400
commita2c15fa4c122558472f8041515072218c8652c7e (patch)
treef4758cff216bd64a3ddff6e73d40cf2ffc8068c9 /drivers/dma
parentc6134c967c5b8b5986371de335fa4ec39de268bc (diff)
DMAENGINE: ste_dma40: fix desc_get
Fix desc_get to alloc a descriptor from the cache if the ones in the list are waiting for the ack. Also, memzero the descriptor when allocated from the list to ensure all fields are cleared. Acked-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/ste_dma40.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 8596c318114b..554e2942667c 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -419,24 +419,29 @@ static void d40_desc_remove(struct d40_desc *d40d)
419 419
420static struct d40_desc *d40_desc_get(struct d40_chan *d40c) 420static struct d40_desc *d40_desc_get(struct d40_chan *d40c)
421{ 421{
422 struct d40_desc *d; 422 struct d40_desc *desc = NULL;
423 struct d40_desc *_d;
424 423
425 if (!list_empty(&d40c->client)) { 424 if (!list_empty(&d40c->client)) {
425 struct d40_desc *d;
426 struct d40_desc *_d;
427
426 list_for_each_entry_safe(d, _d, &d40c->client, node) 428 list_for_each_entry_safe(d, _d, &d40c->client, node)
427 if (async_tx_test_ack(&d->txd)) { 429 if (async_tx_test_ack(&d->txd)) {
428 d40_pool_lli_free(d); 430 d40_pool_lli_free(d);
429 d40_desc_remove(d); 431 d40_desc_remove(d);
432 desc = d;
433 memset(desc, 0, sizeof(*desc));
430 break; 434 break;
431 } 435 }
432 } else {
433 d = kmem_cache_alloc(d40c->base->desc_slab, GFP_NOWAIT);
434 if (d != NULL) {
435 memset(d, 0, sizeof(struct d40_desc));
436 INIT_LIST_HEAD(&d->node);
437 }
438 } 436 }
439 return d; 437
438 if (!desc)
439 desc = kmem_cache_zalloc(d40c->base->desc_slab, GFP_NOWAIT);
440
441 if (desc)
442 INIT_LIST_HEAD(&desc->node);
443
444 return desc;
440} 445}
441 446
442static void d40_desc_free(struct d40_chan *d40c, struct d40_desc *d40d) 447static void d40_desc_free(struct d40_chan *d40c, struct d40_desc *d40d)