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

Commit f7fbce07 authored by Russell King - ARM Linux's avatar Russell King - ARM Linux Committed by Vinod Koul
Browse files

dmaengine: provide a common function for completing a dma descriptor



Provide a common function to do the cookie mechanics for completing
a DMA descriptor.

Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Tested-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
[imx-sdma.c & mxs-dma.c]
Tested-by: default avatarShawn Guo <shawn.guo@linaro.org>
Signed-off-by: default avatarVinod Koul <vinod.koul@linux.intel.com>
parent 884485e1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1542,7 +1542,7 @@ static void pl08x_tasklet(unsigned long data)

	if (txd) {
		/* Update last completed */
		plchan->chan.completed_cookie = txd->tx.cookie;
		dma_cookie_complete(&txd->tx);
	}

	/* If a new descriptor is queued, set it up plchan->at is NULL here */
+1 −1
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
	dev_vdbg(chan2dev(&atchan->chan_common),
		"descriptor %u complete\n", txd->cookie);

	atchan->chan_common.completed_cookie = txd->cookie;
	dma_cookie_complete(txd);

	/* move children to free_list */
	list_splice_init(&desc->tx_list, &atchan->free_list);
+1 −1
Original line number Diff line number Diff line
@@ -691,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->chan.completed_cookie = 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);
+18 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
#ifndef DMAENGINE_H
#define DMAENGINE_H

#include <linux/bug.h>
#include <linux/dmaengine.h>

/**
@@ -27,4 +28,21 @@ static inline dma_cookie_t dma_cookie_assign(struct dma_async_tx_descriptor *tx)
	return cookie;
}

/**
 * dma_cookie_complete - complete a descriptor
 * @tx: descriptor to complete
 *
 * Mark this descriptor complete by updating the channels completed
 * cookie marker.  Zero the descriptors cookie to prevent accidental
 * repeated completions.
 *
 * Note: caller is expected to hold a lock to prevent concurrency.
 */
static inline void dma_cookie_complete(struct dma_async_tx_descriptor *tx)
{
	BUG_ON(tx->cookie < DMA_MIN_COOKIE);
	tx->chan->completed_cookie = tx->cookie;
	tx->cookie = 0;
}

#endif
+1 −1
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ dwc_descriptor_complete(struct dw_dma_chan *dwc, struct dw_desc *desc,
	dev_vdbg(chan2dev(&dwc->chan), "descriptor %u complete\n", txd->cookie);

	spin_lock_irqsave(&dwc->lock, flags);
	dwc->chan.completed_cookie = txd->cookie;
	dma_cookie_complete(txd);
	if (callback_required) {
		callback = txd->callback;
		param = txd->callback_param;
Loading