X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=drivers%2Fdma%2Fcoh901318.c;h=f3505178ff4156201ccde652dd90777237d07ec8;hb=96a2af41c78b1fbb1f567a3486bdc63f7b31c5fd;hp=d65a718c0f9b1ae5819aef9af4c1c58200627a22;hpb=6a488979f574cb4287880db2dbc8b13cee30c5be;p=~andy%2Flinux diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index d65a718c0f9..f3505178ff4 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c @@ -24,6 +24,7 @@ #include #include "coh901318_lli.h" +#include "dmaengine.h" #define COHC_2_DEV(cohc) (&cohc->chan.dev->device) @@ -59,7 +60,6 @@ struct coh901318_base { struct coh901318_chan { spinlock_t lock; int allocated; - int completed; int id; int stopped; @@ -318,20 +318,6 @@ static int coh901318_prep_linked_list(struct coh901318_chan *cohc, return 0; } -static dma_cookie_t -coh901318_assign_cookie(struct coh901318_chan *cohc, - struct coh901318_desc *cohd) -{ - dma_cookie_t cookie = cohc->chan.cookie; - - if (++cookie < 0) - cookie = 1; - - cohc->chan.cookie = cookie; - cohd->desc.cookie = cookie; - - return cookie; -} static struct coh901318_desc * coh901318_desc_get(struct coh901318_chan *cohc) @@ -705,7 +691,7 @@ static void dma_tasklet(unsigned long data) callback_param = cohd_fin->desc.callback_param; /* sign this job as completed on the channel */ - cohc->completed = cohd_fin->desc.cookie; + dma_cookie_complete(&cohd_fin->desc); /* release the lli allocation and remove the descriptor */ coh901318_lli_free(&cohc->base->pool, &cohd_fin->lli); @@ -929,7 +915,7 @@ static int coh901318_alloc_chan_resources(struct dma_chan *chan) coh901318_config(cohc, NULL); cohc->allocated = 1; - cohc->completed = chan->cookie = 1; + chan->completed_cookie = chan->cookie = 1; spin_unlock_irqrestore(&cohc->lock, flags); @@ -966,16 +952,16 @@ coh901318_tx_submit(struct dma_async_tx_descriptor *tx) desc); struct coh901318_chan *cohc = to_coh901318_chan(tx->chan); unsigned long flags; + dma_cookie_t cookie; spin_lock_irqsave(&cohc->lock, flags); - - tx->cookie = coh901318_assign_cookie(cohc, cohd); + cookie = dma_cookie_assign(tx); coh901318_desc_queue(cohc, cohd); spin_unlock_irqrestore(&cohc->lock, flags); - return tx->cookie; + return cookie; } static struct dma_async_tx_descriptor * @@ -1165,17 +1151,12 @@ coh901318_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { struct coh901318_chan *cohc = to_coh901318_chan(chan); - dma_cookie_t last_used; - dma_cookie_t last_complete; - int ret; - - last_complete = cohc->completed; - last_used = chan->cookie; + enum dma_status ret; - ret = dma_async_is_complete(cookie, last_complete, last_used); + ret = dma_cookie_status(chan, cookie, txstate); + /* FIXME: should be conditional on ret != DMA_SUCCESS? */ + dma_set_residue(txstate, coh901318_get_bytes_left(chan)); - dma_set_tx_state(txstate, last_complete, last_used, - coh901318_get_bytes_left(chan)); if (ret == DMA_IN_PROGRESS && cohc->stopped) ret = DMA_PAUSED;