Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 964b2fd8 authored by Dave Jiang's avatar Dave Jiang Committed by Vinod Koul
Browse files

dmaengine: sh_rcar-dmac: 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: default avatarDave Jiang <dave.jiang@intel.com>
Reviewed-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 5ade6683
Loading
Loading
Loading
Loading
+7 −9
Original line number Original line Diff line number Diff line
@@ -1389,21 +1389,18 @@ static irqreturn_t rcar_dmac_isr_channel_thread(int irq, void *dev)
{
{
	struct rcar_dmac_chan *chan = dev;
	struct rcar_dmac_chan *chan = dev;
	struct rcar_dmac_desc *desc;
	struct rcar_dmac_desc *desc;
	struct dmaengine_desc_callback cb;


	spin_lock_irq(&chan->lock);
	spin_lock_irq(&chan->lock);


	/* For cyclic transfers notify the user after every chunk. */
	/* For cyclic transfers notify the user after every chunk. */
	if (chan->desc.running && chan->desc.running->cyclic) {
	if (chan->desc.running && chan->desc.running->cyclic) {
		dma_async_tx_callback callback;
		void *callback_param;

		desc = chan->desc.running;
		desc = chan->desc.running;
		callback = desc->async_tx.callback;
		dmaengine_desc_get_callback(&desc->async_tx, &cb);
		callback_param = desc->async_tx.callback_param;


		if (callback) {
		if (dmaengine_desc_callback_valid(&cb)) {
			spin_unlock_irq(&chan->lock);
			spin_unlock_irq(&chan->lock);
			callback(callback_param);
			dmaengine_desc_callback_invoke(&cb, NULL);
			spin_lock_irq(&chan->lock);
			spin_lock_irq(&chan->lock);
		}
		}
	}
	}
@@ -1418,14 +1415,15 @@ static irqreturn_t rcar_dmac_isr_channel_thread(int irq, void *dev)
		dma_cookie_complete(&desc->async_tx);
		dma_cookie_complete(&desc->async_tx);
		list_del(&desc->node);
		list_del(&desc->node);


		if (desc->async_tx.callback) {
		dmaengine_desc_get_callback(&desc->async_tx, &cb);
		if (dmaengine_desc_callback_valid(&cb)) {
			spin_unlock_irq(&chan->lock);
			spin_unlock_irq(&chan->lock);
			/*
			/*
			 * We own the only reference to this descriptor, we can
			 * We own the only reference to this descriptor, we can
			 * safely dereference it without holding the channel
			 * safely dereference it without holding the channel
			 * lock.
			 * lock.
			 */
			 */
			desc->async_tx.callback(desc->async_tx.callback_param);
			dmaengine_desc_callback_invoke(&cb, NULL);
			spin_lock_irq(&chan->lock);
			spin_lock_irq(&chan->lock);
		}
		}