diff options
author | Per Forlin <per.forlin@linaro.org> | 2011-06-26 23:29:52 +0200 |
---|---|---|
committer | Linus WALLEIJ <linus.walleij@stericsson.com> | 2011-10-22 18:47:31 +0200 |
commit | 0fcd6a7657e3ea251b819a3a832263a5870da790 (patch) | |
tree | 3689b5c61fc43757fe168e721a655c28538189c8 | |
parent | bd06d4ef805657d13eed5a476864f739bbcba997 (diff) |
dmaengine/ste_dma40: add a separate queue for pending requests
ST-Ericsson ID: 362972
ST-Ericsson FOSS-OUT ID: NA
ST-Ericsson Linux next: NA
tx_submit will add descriptors to the pending queue. Issue pending
will then move the pending descriptors to the transfer queue.
Change-Id: I788d74f7680e050b85a6245505c43285a1a027fc
Signed-off-by: Per Forlin <per.forlin@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/34960
Tested-by: Narayanan GOPALAKRISHNAN <narayanan.gopalakrishnan@stericsson.com>
Reviewed-by: Per FORLIN <per.forlin@stericsson.com>
Reviewed-by: Linus WALLEIJ <linus.walleij@stericsson.com>
-rw-r--r-- | drivers/dma/ste_dma40.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index e209599f628..4f0aa596a8c 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -265,6 +265,7 @@ struct d40_chan { struct dma_chan chan; struct tasklet_struct tasklet; struct list_head client; + struct list_head pending_queue; struct list_head active; struct list_head done; struct list_head queue; @@ -735,7 +736,20 @@ static struct d40_desc *d40_first_active_get(struct d40_chan *d40c) static void d40_desc_queue(struct d40_chan *d40c, struct d40_desc *desc) { - list_add_tail(&desc->node, &d40c->queue); + list_add_tail(&desc->node, &d40c->pending_queue); +} + +static struct d40_desc *d40_first_pending(struct d40_chan *d40c) +{ + struct d40_desc *d; + + if (list_empty(&d40c->pending_queue)) + return NULL; + + d = list_first_entry(&d40c->pending_queue, + struct d40_desc, + node); + return d; } static struct d40_desc *d40_first_queued(struct d40_chan *d40c) @@ -1023,6 +1037,12 @@ static void d40_term_all(struct d40_chan *d40c) d40_desc_free(d40c, d40d); } + /* Release pending descriptors */ + while ((d40d = d40_first_pending(d40c))) { + d40_desc_remove(d40d); + d40_desc_free(d40c, d40d); + } + d40c->pending_tx = 0; } @@ -2377,7 +2397,9 @@ static void d40_issue_pending(struct dma_chan *chan) spin_lock_irqsave(&d40c->lock, flags); - /* Busy means that pending jobs are already being processed */ + list_splice_tail_init(&d40c->pending_queue, &d40c->queue); + + /* Busy means that queued jobs are already being processed */ if (!d40c->busy) (void) d40_queue_start(d40c); @@ -2873,6 +2895,7 @@ static void __init d40_chan_init(struct d40_base *base, struct dma_device *dma, INIT_LIST_HEAD(&d40c->done); INIT_LIST_HEAD(&d40c->active); INIT_LIST_HEAD(&d40c->queue); + INIT_LIST_HEAD(&d40c->pending_queue); INIT_LIST_HEAD(&d40c->client); tasklet_init(&d40c->tasklet, dma_tasklet, |