dmaengine: ipu: convert callback to helper function

This is in preperation of moving to a callback that provides results to the
callback for the transaction. The conversion will maintain current behavior
and the driver must convert to new callback mechanism at a later time in
order to receive results.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
Dave Jiang 2016-07-20 13:11:45 -07:00 коммит произвёл Vinod Koul
Родитель db89e3c877
Коммит 80a7d64325
1 изменённых файлов: 8 добавлений и 10 удалений

Просмотреть файл

@ -1160,11 +1160,10 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id)
struct scatterlist **sg, *sgnext, *sgnew = NULL; struct scatterlist **sg, *sgnext, *sgnew = NULL;
/* Next transfer descriptor */ /* Next transfer descriptor */
struct idmac_tx_desc *desc, *descnew; struct idmac_tx_desc *desc, *descnew;
dma_async_tx_callback callback;
void *callback_param;
bool done = false; bool done = false;
u32 ready0, ready1, curbuf, err; u32 ready0, ready1, curbuf, err;
unsigned long flags; unsigned long flags;
struct dmaengine_desc_callback cb;
/* IDMAC has cleared the respective BUFx_RDY bit, we manage the buffer */ /* IDMAC has cleared the respective BUFx_RDY bit, we manage the buffer */
@ -1278,12 +1277,12 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id)
if (likely(sgnew) && if (likely(sgnew) &&
ipu_submit_buffer(ichan, descnew, sgnew, ichan->active_buffer) < 0) { ipu_submit_buffer(ichan, descnew, sgnew, ichan->active_buffer) < 0) {
callback = descnew->txd.callback; dmaengine_desc_get_callback(&descnew->txd, &cb);
callback_param = descnew->txd.callback_param;
list_del_init(&descnew->list); list_del_init(&descnew->list);
spin_unlock(&ichan->lock); spin_unlock(&ichan->lock);
if (callback)
callback(callback_param); dmaengine_desc_callback_invoke(&cb, NULL);
spin_lock(&ichan->lock); spin_lock(&ichan->lock);
} }
@ -1292,13 +1291,12 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id)
if (done) if (done)
dma_cookie_complete(&desc->txd); dma_cookie_complete(&desc->txd);
callback = desc->txd.callback; dmaengine_desc_get_callback(&desc->txd, &cb);
callback_param = desc->txd.callback_param;
spin_unlock(&ichan->lock); spin_unlock(&ichan->lock);
if (done && (desc->txd.flags & DMA_PREP_INTERRUPT) && callback) if (done && (desc->txd.flags & DMA_PREP_INTERRUPT))
callback(callback_param); dmaengine_desc_callback_invoke(&cb, NULL);
return IRQ_HANDLED; return IRQ_HANDLED;
} }