From 4d4e58de32a192fea65ab84509d17d199bd291c8 Mon Sep 17 00:00:00 2001 From: Russell King - ARM Linux Date: Tue, 6 Mar 2012 22:34:06 +0000 Subject: dmaengine: move last completed cookie into generic dma_chan structure Every DMA engine implementation declares a last completed dma cookie in their private dma channel structures. This is pointless, and forces driver specific code. Move this out into the common dma_chan structure. Signed-off-by: Russell King Tested-by: Linus Walleij Reviewed-by: Linus Walleij Acked-by: Jassi Brar [imx-sdma.c & mxs-dma.c] Tested-by: Shawn Guo Signed-off-by: Vinod Koul --- drivers/dma/pl330.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/dma/pl330.c') diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 84ebea9bc53a..99c31a76e74e 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -51,9 +51,6 @@ struct dma_pl330_chan { /* DMA-Engine Channel */ struct dma_chan chan; - /* Last completed cookie */ - dma_cookie_t completed; - /* List of to be xfered descriptors */ struct list_head work_list; @@ -234,7 +231,7 @@ static void pl330_tasklet(unsigned long data) /* Pick up ripe tomatoes */ list_for_each_entry_safe(desc, _dt, &pch->work_list, node) if (desc->status == DONE) { - pch->completed = desc->txd.cookie; + pch->chan.completed_cookie = desc->txd.cookie; list_move_tail(&desc->node, &list); } @@ -305,7 +302,7 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan) spin_lock_irqsave(&pch->lock, flags); - pch->completed = chan->cookie = 1; + chan->completed_cookie = chan->cookie = 1; pch->cyclic = false; pch->pl330_chid = pl330_request_channel(&pdmac->pif); @@ -400,7 +397,7 @@ pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie, dma_cookie_t last_done, last_used; int ret; - last_done = pch->completed; + last_done = chan->completed_cookie; last_used = chan->cookie; ret = dma_async_is_complete(cookie, last_done, last_used); -- cgit v1.2.3 From d2ebfb335b0426deb1a4fb14e4e926d81ecd8235 Mon Sep 17 00:00:00 2001 From: Russell King - ARM Linux Date: Tue, 6 Mar 2012 22:34:26 +0000 Subject: dmaengine: add private header file Add a local private header file to contain definitions and declarations which should only be used by DMA engine drivers. We also fix linux/dmaengine.h to use LINUX_DMAENGINE_H to guard against multiple inclusion. Signed-off-by: Russell King Tested-by: Linus Walleij Reviewed-by: Linus Walleij Acked-by: Jassi Brar [imx-sdma.c & mxs-dma.c] Tested-by: Shawn Guo Signed-off-by: Vinod Koul --- drivers/dma/amba-pl08x.c | 2 ++ drivers/dma/at_hdmac.c | 1 + drivers/dma/coh901318.c | 1 + drivers/dma/dmaengine.h | 10 ++++++++++ drivers/dma/dw_dmac.c | 1 + drivers/dma/ep93xx_dma.c | 2 ++ drivers/dma/fsldma.c | 1 + drivers/dma/imx-dma.c | 2 ++ drivers/dma/imx-sdma.c | 2 ++ drivers/dma/intel_mid_dma.c | 2 ++ drivers/dma/ioat/dma.c | 2 ++ drivers/dma/ioat/dma_v2.c | 2 ++ drivers/dma/iop-adma.c | 2 ++ drivers/dma/ipu/ipu_idmac.c | 1 + drivers/dma/mpc512x_dma.c | 2 ++ drivers/dma/mv_xor.c | 2 ++ drivers/dma/mxs-dma.c | 2 ++ drivers/dma/pch_dma.c | 2 ++ drivers/dma/pl330.c | 2 ++ drivers/dma/ppc4xx/adma.c | 1 + drivers/dma/shdma.c | 2 ++ drivers/dma/ste_dma40.c | 1 + drivers/dma/timb_dma.c | 2 ++ drivers/dma/txx9dmac.c | 2 ++ include/linux/dmaengine.h | 4 ++-- 25 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 drivers/dma/dmaengine.h (limited to 'drivers/dma/pl330.c') diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index e510447a685a..45f5e66e1c84 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -85,6 +85,8 @@ #include #include +#include "dmaengine.h" + #define DRIVER_NAME "pl08xdmac" static struct amba_driver pl08x_amba_driver; diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 6baf5d717262..ce26ba381144 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -27,6 +27,7 @@ #include #include "at_hdmac_regs.h" +#include "dmaengine.h" /* * Glossary diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index 521434bc3130..fb0d1245ade5 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) diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h new file mode 100644 index 000000000000..968570dde2eb --- /dev/null +++ b/drivers/dma/dmaengine.h @@ -0,0 +1,10 @@ +/* + * The contents of this file are private to DMA engine drivers, and is not + * part of the API to be used by DMA engine users. + */ +#ifndef DMAENGINE_H +#define DMAENGINE_H + +#include + +#endif diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index 5bd23006ff4a..b279e1920725 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c @@ -23,6 +23,7 @@ #include #include "dw_dmac_regs.h" +#include "dmaengine.h" /* * This supports the Synopsys "DesignWare AHB Central DMA Controller", diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index bc457878cffd..326019832a13 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c @@ -28,6 +28,8 @@ #include +#include "dmaengine.h" + /* M2P registers */ #define M2P_CONTROL 0x0000 #define M2P_CONTROL_STALLINT BIT(0) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 9b5cb8a43cfa..2ebbe572f9e0 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -35,6 +35,7 @@ #include #include +#include "dmaengine.h" #include "fsldma.h" #define chan_dbg(chan, fmt, arg...) \ diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index d3ddcba87f81..cead5e4bd38c 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -30,6 +30,8 @@ #include #include +#include "dmaengine.h" + struct imxdma_channel { struct imxdma_engine *imxdma; unsigned int channel; diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 49aa4e876645..48a791f93adc 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -43,6 +43,8 @@ #include #include +#include "dmaengine.h" + /* SDMA registers */ #define SDMA_H_C0PTR 0x000 #define SDMA_H_INTR 0x004 diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c index 40e47e6c7ed8..55d0451670b0 100644 --- a/drivers/dma/intel_mid_dma.c +++ b/drivers/dma/intel_mid_dma.c @@ -29,6 +29,8 @@ #include #include +#include "dmaengine.h" + #define MAX_CHAN 4 /*max ch across controllers*/ #include "intel_mid_dma_regs.h" diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index fab440af1f9a..dfe411b2014f 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -40,6 +40,8 @@ #include "registers.h" #include "hw.h" +#include "../dmaengine.h" + int ioat_pending_level = 4; module_param(ioat_pending_level, int, 0644); MODULE_PARM_DESC(ioat_pending_level, diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index d3f0aff2c02a..6c1e6754d9bd 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c @@ -41,6 +41,8 @@ #include "registers.h" #include "hw.h" +#include "../dmaengine.h" + int ioat_ring_alloc_order = 8; module_param(ioat_ring_alloc_order, int, 0644); MODULE_PARM_DESC(ioat_ring_alloc_order, diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index d8027c2b42c0..650bf1e185e8 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c @@ -36,6 +36,8 @@ #include +#include "dmaengine.h" + #define to_iop_adma_chan(chan) container_of(chan, struct iop_adma_chan, common) #define to_iop_adma_device(dev) \ container_of(dev, struct iop_adma_device, common) diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c index 9149ade6a5d9..0fcff6508fb1 100644 --- a/drivers/dma/ipu/ipu_idmac.c +++ b/drivers/dma/ipu/ipu_idmac.c @@ -25,6 +25,7 @@ #include +#include "../dmaengine.h" #include "ipu_intern.h" #define FS_VF_IN_VALID 0x00000002 diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c index 39a5cde9f428..c56b3fe5d3fa 100644 --- a/drivers/dma/mpc512x_dma.c +++ b/drivers/dma/mpc512x_dma.c @@ -44,6 +44,8 @@ #include +#include "dmaengine.h" + /* Number of DMA Transfer descriptors allocated per channel */ #define MPC_DMA_DESCRIPTORS 64 diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index c6a84dac112c..ee61778ba8a2 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -26,6 +26,8 @@ #include #include #include + +#include "dmaengine.h" #include "mv_xor.h" static void mv_xor_issue_pending(struct dma_chan *chan); diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index 3696e6e4143a..daa84ee2a187 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c @@ -28,6 +28,8 @@ #include #include +#include "dmaengine.h" + /* * NOTE: The term "PIO" throughout the mxs-dma implementation means * PIO mode of mxs apbh-dma and apbx-dma. With this working mode, diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c index 79a71858497c..2b3479d850c9 100644 --- a/drivers/dma/pch_dma.c +++ b/drivers/dma/pch_dma.c @@ -25,6 +25,8 @@ #include #include +#include "dmaengine.h" + #define DRV_NAME "pch-dma" #define DMA_CTL0_DISABLE 0x0 diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 99c31a76e74e..2db70748403f 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -21,6 +21,8 @@ #include #include +#include "dmaengine.h" + #define NR_DEFAULT_DESC 16 enum desc_status { diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c index f878322ecbcb..40082ec8326c 100644 --- a/drivers/dma/ppc4xx/adma.c +++ b/drivers/dma/ppc4xx/adma.c @@ -46,6 +46,7 @@ #include #include #include "adma.h" +#include "../dmaengine.h" enum ppc_adma_init_code { PPC_ADMA_INIT_OK = 0, diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index ae84c12e3865..c2914330b8fc 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c @@ -30,6 +30,8 @@ #include #include #include + +#include "dmaengine.h" #include "shdma.h" /* DMA descriptor control */ diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index cfca2a06d1af..156b98f661a3 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -21,6 +21,7 @@ #include +#include "dmaengine.h" #include "ste_dma40_ll.h" #define D40_NAME "dma40" diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c index a1d15598cf7e..4b61879284d1 100644 --- a/drivers/dma/timb_dma.c +++ b/drivers/dma/timb_dma.c @@ -31,6 +31,8 @@ #include +#include "dmaengine.h" + #define DRIVER_NAME "timb-dma" /* Global DMA registers */ diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c index a917b6723bad..db6d809d4d04 100644 --- a/drivers/dma/txx9dmac.c +++ b/drivers/dma/txx9dmac.c @@ -15,6 +15,8 @@ #include #include #include + +#include "dmaengine.h" #include "txx9dmac.h" static struct txx9dmac_chan *to_txx9dmac_chan(struct dma_chan *chan) diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index c59c4f0c2cc9..715babf4bffe 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -18,8 +18,8 @@ * The full GNU General Public License is included in this distribution in the * file called COPYING. */ -#ifndef DMAENGINE_H -#define DMAENGINE_H +#ifndef LINUX_DMAENGINE_H +#define LINUX_DMAENGINE_H #include #include -- cgit v1.2.3 From 884485e1f12dcd39390f042e772cdbefc9ebb750 Mon Sep 17 00:00:00 2001 From: Russell King - ARM Linux Date: Tue, 6 Mar 2012 22:34:46 +0000 Subject: dmaengine: consolidate assignment of DMA cookies Everyone deals with assigning DMA cookies in the same way (it's part of the API so they should be), so lets consolidate the common code into a helper function to avoid this duplication. Signed-off-by: Russell King Tested-by: Linus Walleij Reviewed-by: Linus Walleij Acked-by: Jassi Brar [imx-sdma.c & mxs-dma.c] Tested-by: Shawn Guo Signed-off-by: Vinod Koul --- drivers/dma/amba-pl08x.c | 9 +++------ drivers/dma/at_hdmac.c | 23 +---------------------- drivers/dma/coh901318.c | 20 +++----------------- drivers/dma/dmaengine.h | 20 ++++++++++++++++++++ drivers/dma/dw_dmac.c | 17 +---------------- drivers/dma/ep93xx_dma.c | 9 +-------- drivers/dma/fsldma.c | 9 +-------- drivers/dma/imx-dma.c | 15 +-------------- drivers/dma/imx-sdma.c | 16 +--------------- drivers/dma/intel_mid_dma.c | 9 +-------- drivers/dma/ioat/dma.c | 7 +------ drivers/dma/ioat/dma_v2.c | 8 ++------ drivers/dma/iop-adma.c | 14 +------------- drivers/dma/ipu/ipu_idmac.c | 9 +-------- drivers/dma/mpc512x_dma.c | 8 +------- drivers/dma/mv_xor.c | 14 +------------- drivers/dma/mxs-dma.c | 15 +-------------- drivers/dma/pch_dma.c | 16 +--------------- drivers/dma/pl330.c | 14 ++------------ drivers/dma/ppc4xx/adma.c | 19 +------------------ drivers/dma/shdma.c | 8 +------- drivers/dma/sirf-dma.c | 8 +------- drivers/dma/ste_dma40.c | 13 +++---------- drivers/dma/timb_dma.c | 7 +------ drivers/dma/txx9dmac.c | 17 +---------------- 25 files changed, 52 insertions(+), 272 deletions(-) (limited to 'drivers/dma/pl330.c') diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 45f5e66e1c84..d8d3dc273f29 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -921,13 +921,10 @@ static dma_cookie_t pl08x_tx_submit(struct dma_async_tx_descriptor *tx) struct pl08x_dma_chan *plchan = to_pl08x_chan(tx->chan); struct pl08x_txd *txd = to_pl08x_txd(tx); unsigned long flags; + dma_cookie_t cookie; spin_lock_irqsave(&plchan->lock, flags); - - plchan->chan.cookie += 1; - if (plchan->chan.cookie < 0) - plchan->chan.cookie = 1; - tx->cookie = plchan->chan.cookie; + cookie = dma_cookie_assign(tx); /* Put this onto the pending list */ list_add_tail(&txd->node, &plchan->pend_list); @@ -947,7 +944,7 @@ static dma_cookie_t pl08x_tx_submit(struct dma_async_tx_descriptor *tx) spin_unlock_irqrestore(&plchan->lock, flags); - return tx->cookie; + return cookie; } static struct dma_async_tx_descriptor *pl08x_prep_dma_interrupt( diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index ce26ba381144..df47e7d6164b 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -192,27 +192,6 @@ static void atc_desc_chain(struct at_desc **first, struct at_desc **prev, *prev = desc; } -/** - * atc_assign_cookie - compute and assign new cookie - * @atchan: channel we work on - * @desc: descriptor to assign cookie for - * - * Called with atchan->lock held and bh disabled - */ -static dma_cookie_t -atc_assign_cookie(struct at_dma_chan *atchan, struct at_desc *desc) -{ - dma_cookie_t cookie = atchan->chan_common.cookie; - - if (++cookie < 0) - cookie = 1; - - atchan->chan_common.cookie = cookie; - desc->txd.cookie = cookie; - - return cookie; -} - /** * atc_dostart - starts the DMA engine for real * @atchan: the channel we want to start @@ -548,7 +527,7 @@ static dma_cookie_t atc_tx_submit(struct dma_async_tx_descriptor *tx) unsigned long flags; spin_lock_irqsave(&atchan->lock, flags); - cookie = atc_assign_cookie(atchan, desc); + cookie = dma_cookie_assign(tx); if (list_empty(&atchan->active_list)) { dev_vdbg(chan2dev(tx->chan), "tx_submit: started %u\n", diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index fb0d1245ade5..843a1a3b8a81 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c @@ -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) @@ -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 * diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h index 968570dde2eb..7692c8644045 100644 --- a/drivers/dma/dmaengine.h +++ b/drivers/dma/dmaengine.h @@ -7,4 +7,24 @@ #include +/** + * dma_cookie_assign - assign a DMA engine cookie to the descriptor + * @tx: descriptor needing cookie + * + * Assign a unique non-zero per-channel cookie to the descriptor. + * Note: caller is expected to hold a lock to prevent concurrency. + */ +static inline dma_cookie_t dma_cookie_assign(struct dma_async_tx_descriptor *tx) +{ + struct dma_chan *chan = tx->chan; + dma_cookie_t cookie; + + cookie = chan->cookie + 1; + if (cookie < DMA_MIN_COOKIE) + cookie = DMA_MIN_COOKIE; + tx->cookie = chan->cookie = cookie; + + return cookie; +} + #endif diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index b279e1920725..3a4ca67ace02 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c @@ -157,21 +157,6 @@ static void dwc_desc_put(struct dw_dma_chan *dwc, struct dw_desc *desc) } } -/* Called with dwc->lock held and bh disabled */ -static dma_cookie_t -dwc_assign_cookie(struct dw_dma_chan *dwc, struct dw_desc *desc) -{ - dma_cookie_t cookie = dwc->chan.cookie; - - if (++cookie < 0) - cookie = 1; - - dwc->chan.cookie = cookie; - desc->txd.cookie = cookie; - - return cookie; -} - static void dwc_initialize(struct dw_dma_chan *dwc) { struct dw_dma *dw = to_dw_dma(dwc->chan.device); @@ -603,7 +588,7 @@ static dma_cookie_t dwc_tx_submit(struct dma_async_tx_descriptor *tx) unsigned long flags; spin_lock_irqsave(&dwc->lock, flags); - cookie = dwc_assign_cookie(dwc, desc); + cookie = dma_cookie_assign(tx); /* * REVISIT: We should attempt to chain as many descriptors as diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index 326019832a13..e5aaae87ddfb 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c @@ -783,17 +783,10 @@ static dma_cookie_t ep93xx_dma_tx_submit(struct dma_async_tx_descriptor *tx) unsigned long flags; spin_lock_irqsave(&edmac->lock, flags); - - cookie = edmac->chan.cookie; - - if (++cookie < 0) - cookie = 1; + cookie = dma_cookie_assign(tx); desc = container_of(tx, struct ep93xx_dma_desc, txd); - edmac->chan.cookie = cookie; - desc->txd.cookie = cookie; - /* * If nothing is currently prosessed, we push this descriptor * directly to the hardware. Otherwise we put the descriptor diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 2ebbe572f9e0..04b4347ba4e9 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -414,17 +414,10 @@ static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) * assign cookies to all of the software descriptors * that make up this transaction */ - cookie = chan->common.cookie; list_for_each_entry(child, &desc->tx_list, node) { - cookie++; - if (cookie < DMA_MIN_COOKIE) - cookie = DMA_MIN_COOKIE; - - child->async_tx.cookie = cookie; + cookie = dma_cookie_assign(&child->async_tx); } - chan->common.cookie = cookie; - /* put this transaction onto the tail of the pending queue */ append_ld_queue(chan, desc); diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index cead5e4bd38c..687fc687aaf6 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -165,19 +165,6 @@ static enum dma_status imxdma_tx_status(struct dma_chan *chan, return ret; } -static dma_cookie_t imxdma_assign_cookie(struct imxdma_channel *imxdma) -{ - dma_cookie_t cookie = imxdma->chan.cookie; - - if (++cookie < 0) - cookie = 1; - - imxdma->chan.cookie = cookie; - imxdma->desc.cookie = cookie; - - return cookie; -} - static dma_cookie_t imxdma_tx_submit(struct dma_async_tx_descriptor *tx) { struct imxdma_channel *imxdmac = to_imxdma_chan(tx->chan); @@ -185,7 +172,7 @@ static dma_cookie_t imxdma_tx_submit(struct dma_async_tx_descriptor *tx) spin_lock_irq(&imxdmac->lock); - cookie = imxdma_assign_cookie(imxdmac); + cookie = dma_cookie_assign(tx); spin_unlock_irq(&imxdmac->lock); diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 48a791f93adc..3f0c002933f3 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -815,19 +815,6 @@ out: return ret; } -static dma_cookie_t sdma_assign_cookie(struct sdma_channel *sdmac) -{ - dma_cookie_t cookie = sdmac->chan.cookie; - - if (++cookie < 0) - cookie = 1; - - sdmac->chan.cookie = cookie; - sdmac->desc.cookie = cookie; - - return cookie; -} - static struct sdma_channel *to_sdma_chan(struct dma_chan *chan) { return container_of(chan, struct sdma_channel, chan); @@ -841,7 +828,7 @@ static dma_cookie_t sdma_tx_submit(struct dma_async_tx_descriptor *tx) spin_lock_irqsave(&sdmac->lock, flags); - cookie = sdma_assign_cookie(sdmac); + cookie = dma_cookie_assign(tx); spin_unlock_irqrestore(&sdmac->lock, flags); @@ -1140,7 +1127,6 @@ static void sdma_issue_pending(struct dma_chan *chan) struct sdma_engine *sdma = sdmac->sdma; if (sdmac->status == DMA_IN_PROGRESS) - sdma_enable_channel(sdma, sdmac->channel); } #define SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1 34 diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c index 55d0451670b0..e9217c390b76 100644 --- a/drivers/dma/intel_mid_dma.c +++ b/drivers/dma/intel_mid_dma.c @@ -436,14 +436,7 @@ static dma_cookie_t intel_mid_dma_tx_submit(struct dma_async_tx_descriptor *tx) dma_cookie_t cookie; spin_lock_bh(&midc->lock); - cookie = midc->chan.cookie; - - if (++cookie < 0) - cookie = 1; - - midc->chan.cookie = cookie; - desc->txd.cookie = cookie; - + cookie = dma_cookie_assign(tx); if (list_empty(&midc->active_list)) list_add_tail(&desc->desc_node, &midc->active_list); diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index dfe411b2014f..5c06117ac682 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -237,12 +237,7 @@ static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx) spin_lock_bh(&ioat->desc_lock); /* cookie incr and addition to used_list must be atomic */ - cookie = c->cookie; - cookie++; - if (cookie < 0) - cookie = 1; - c->cookie = cookie; - tx->cookie = cookie; + cookie = dma_cookie_assign(tx); dev_dbg(to_dev(&ioat->base), "%s: cookie: %d\n", __func__, cookie); /* write address into NextDescriptor field of last desc in chain */ diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index 6c1e6754d9bd..17ecacb70d40 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c @@ -400,13 +400,9 @@ static dma_cookie_t ioat2_tx_submit_unlock(struct dma_async_tx_descriptor *tx) struct dma_chan *c = tx->chan; struct ioat2_dma_chan *ioat = to_ioat2_chan(c); struct ioat_chan_common *chan = &ioat->base; - dma_cookie_t cookie = c->cookie; + dma_cookie_t cookie; - cookie++; - if (cookie < 0) - cookie = 1; - tx->cookie = cookie; - c->cookie = cookie; + cookie = dma_cookie_assign(tx); dev_dbg(to_dev(&ioat->base), "%s: cookie: %d\n", __func__, cookie); if (!test_and_set_bit(IOAT_COMPLETION_PENDING, &chan->state)) diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index 650bf1e185e8..f2392d59568d 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c @@ -440,18 +440,6 @@ retry: return NULL; } -static dma_cookie_t -iop_desc_assign_cookie(struct iop_adma_chan *iop_chan, - struct iop_adma_desc_slot *desc) -{ - dma_cookie_t cookie = iop_chan->common.cookie; - cookie++; - if (cookie < 0) - cookie = 1; - iop_chan->common.cookie = desc->async_tx.cookie = cookie; - return cookie; -} - static void iop_adma_check_threshold(struct iop_adma_chan *iop_chan) { dev_dbg(iop_chan->device->common.dev, "pending: %d\n", @@ -479,7 +467,7 @@ iop_adma_tx_submit(struct dma_async_tx_descriptor *tx) slots_per_op = grp_start->slots_per_op; spin_lock_bh(&iop_chan->lock); - cookie = iop_desc_assign_cookie(iop_chan, sw_desc); + cookie = dma_cookie_assign(tx); old_chain_tail = list_entry(iop_chan->chain.prev, struct iop_adma_desc_slot, chain_node); diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c index 0fcff6508fb1..d4620c53fd2d 100644 --- a/drivers/dma/ipu/ipu_idmac.c +++ b/drivers/dma/ipu/ipu_idmac.c @@ -867,14 +867,7 @@ static dma_cookie_t idmac_tx_submit(struct dma_async_tx_descriptor *tx) dev_dbg(dev, "Submitting sg %p\n", &desc->sg[0]); - cookie = ichan->dma_chan.cookie; - - if (++cookie < 0) - cookie = 1; - - /* from dmaengine.h: "last cookie value returned to client" */ - ichan->dma_chan.cookie = cookie; - tx->cookie = cookie; + cookie = dma_cookie_assign(tx); /* ipu->lock can be taken under ichan->lock, but not v.v. */ spin_lock_irqsave(&ichan->lock, flags); diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c index c56b3fe5d3fa..0253d5aecdb1 100644 --- a/drivers/dma/mpc512x_dma.c +++ b/drivers/dma/mpc512x_dma.c @@ -439,13 +439,7 @@ static dma_cookie_t mpc_dma_tx_submit(struct dma_async_tx_descriptor *txd) mpc_dma_execute(mchan); /* Update cookie */ - cookie = mchan->chan.cookie + 1; - if (cookie <= 0) - cookie = 1; - - mchan->chan.cookie = cookie; - mdesc->desc.cookie = cookie; - + cookie = dma_cookie_assign(txd); spin_unlock_irqrestore(&mchan->lock, flags); return cookie; diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index ee61778ba8a2..d9810ce3794c 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -536,18 +536,6 @@ retry: return NULL; } -static dma_cookie_t -mv_desc_assign_cookie(struct mv_xor_chan *mv_chan, - struct mv_xor_desc_slot *desc) -{ - dma_cookie_t cookie = mv_chan->common.cookie; - - if (++cookie < 0) - cookie = 1; - mv_chan->common.cookie = desc->async_tx.cookie = cookie; - return cookie; -} - /************************ DMA engine API functions ****************************/ static dma_cookie_t mv_xor_tx_submit(struct dma_async_tx_descriptor *tx) @@ -565,7 +553,7 @@ mv_xor_tx_submit(struct dma_async_tx_descriptor *tx) grp_start = sw_desc->group_head; spin_lock_bh(&mv_chan->lock); - cookie = mv_desc_assign_cookie(mv_chan, sw_desc); + cookie = dma_cookie_assign(tx); if (list_empty(&mv_chan->chain)) list_splice_init(&sw_desc->tx_list, &mv_chan->chain); diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index daa84ee2a187..4d3b6ff3050f 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c @@ -194,19 +194,6 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan *mxs_chan) mxs_chan->status = DMA_IN_PROGRESS; } -static dma_cookie_t mxs_dma_assign_cookie(struct mxs_dma_chan *mxs_chan) -{ - dma_cookie_t cookie = mxs_chan->chan.cookie; - - if (++cookie < 0) - cookie = 1; - - mxs_chan->chan.cookie = cookie; - mxs_chan->desc.cookie = cookie; - - return cookie; -} - static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan) { return container_of(chan, struct mxs_dma_chan, chan); @@ -218,7 +205,7 @@ static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx) mxs_dma_enable_chan(mxs_chan); - return mxs_dma_assign_cookie(mxs_chan); + return dma_cookie_assign(tx); } static void mxs_dma_tasklet(unsigned long data) diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c index 2b3479d850c9..5218e48aed0e 100644 --- a/drivers/dma/pch_dma.c +++ b/drivers/dma/pch_dma.c @@ -417,20 +417,6 @@ static void pdc_advance_work(struct pch_dma_chan *pd_chan) } } -static dma_cookie_t pdc_assign_cookie(struct pch_dma_chan *pd_chan, - struct pch_dma_desc *desc) -{ - dma_cookie_t cookie = pd_chan->chan.cookie; - - if (++cookie < 0) - cookie = 1; - - pd_chan->chan.cookie = cookie; - desc->txd.cookie = cookie; - - return cookie; -} - static dma_cookie_t pd_tx_submit(struct dma_async_tx_descriptor *txd) { struct pch_dma_desc *desc = to_pd_desc(txd); @@ -438,7 +424,7 @@ static dma_cookie_t pd_tx_submit(struct dma_async_tx_descriptor *txd) dma_cookie_t cookie; spin_lock(&pd_chan->lock); - cookie = pdc_assign_cookie(pd_chan, desc); + cookie = dma_cookie_assign(txd); if (list_empty(&pd_chan->active_list)) { list_add_tail(&desc->desc_node, &pd_chan->active_list); diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 2db70748403f..644eb789958b 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -429,26 +429,16 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx) spin_lock_irqsave(&pch->lock, flags); /* Assign cookies to all nodes */ - cookie = tx->chan->cookie; - while (!list_empty(&last->node)) { desc = list_entry(last->node.next, struct dma_pl330_desc, node); - if (++cookie < 0) - cookie = 1; - desc->txd.cookie = cookie; + dma_cookie_assign(&desc->txd); list_move_tail(&desc->node, &pch->work_list); } - if (++cookie < 0) - cookie = 1; - last->txd.cookie = cookie; - + cookie = dma_cookie_assign(&last->txd); list_add_tail(&last->node, &pch->work_list); - - tx->chan->cookie = cookie; - spin_unlock_irqrestore(&pch->lock, flags); return cookie; diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c index 40082ec8326c..12e94dd6fc3d 100644 --- a/drivers/dma/ppc4xx/adma.c +++ b/drivers/dma/ppc4xx/adma.c @@ -2150,22 +2150,6 @@ static int ppc440spe_adma_alloc_chan_resources(struct dma_chan *chan) return (i > 0) ? i : -ENOMEM; } -/** - * ppc440spe_desc_assign_cookie - assign a cookie - */ -static dma_cookie_t ppc440spe_desc_assign_cookie( - struct ppc440spe_adma_chan *chan, - struct ppc440spe_adma_desc_slot *desc) -{ - dma_cookie_t cookie = chan->common.cookie; - - cookie++; - if (cookie < 0) - cookie = 1; - chan->common.cookie = desc->async_tx.cookie = cookie; - return cookie; -} - /** * ppc440spe_rxor_set_region_data - */ @@ -2236,8 +2220,7 @@ static dma_cookie_t ppc440spe_adma_tx_submit(struct dma_async_tx_descriptor *tx) slots_per_op = group_start->slots_per_op; spin_lock_bh(&chan->lock); - - cookie = ppc440spe_desc_assign_cookie(chan, sw_desc); + cookie = dma_cookie_assign(tx); if (unlikely(list_empty(&chan->chain))) { /* first peer */ diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index c2914330b8fc..96d0a4fe8dd9 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c @@ -298,13 +298,7 @@ static dma_cookie_t sh_dmae_tx_submit(struct dma_async_tx_descriptor *tx) else power_up = false; - cookie = sh_chan->common.cookie; - cookie++; - if (cookie < 0) - cookie = 1; - - sh_chan->common.cookie = cookie; - tx->cookie = cookie; + cookie = dma_cookie_assign(tx); /* Mark all chunks of this descriptor as submitted, move to the queue */ list_for_each_entry_safe(chunk, c, desc->node.prev, node) { diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c index 60473f00cf1c..7bb154a85332 100644 --- a/drivers/dma/sirf-dma.c +++ b/drivers/dma/sirf-dma.c @@ -257,13 +257,7 @@ static dma_cookie_t sirfsoc_dma_tx_submit(struct dma_async_tx_descriptor *txd) /* Move descriptor to queue */ list_move_tail(&sdesc->node, &schan->queued); - /* Update cookie */ - cookie = schan->chan.cookie + 1; - if (cookie <= 0) - cookie = 1; - - schan->chan.cookie = cookie; - sdesc->desc.cookie = cookie; + cookie = dma_cookie_assign(txd); spin_unlock_irqrestore(&schan->lock, flags); diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 156b98f661a3..23e2edc4afd4 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -1220,21 +1220,14 @@ static dma_cookie_t d40_tx_submit(struct dma_async_tx_descriptor *tx) chan); struct d40_desc *d40d = container_of(tx, struct d40_desc, txd); unsigned long flags; + dma_cookie_t cookie; spin_lock_irqsave(&d40c->lock, flags); - - d40c->chan.cookie++; - - if (d40c->chan.cookie < 0) - d40c->chan.cookie = 1; - - d40d->txd.cookie = d40c->chan.cookie; - + cookie = dma_cookie_assign(tx); d40_desc_queue(d40c, d40d); - spin_unlock_irqrestore(&d40c->lock, flags); - return tx->cookie; + return cookie; } static int d40_start(struct d40_chan *d40c) diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c index 4b61879284d1..b6e83fc27c4e 100644 --- a/drivers/dma/timb_dma.c +++ b/drivers/dma/timb_dma.c @@ -350,12 +350,7 @@ static dma_cookie_t td_tx_submit(struct dma_async_tx_descriptor *txd) dma_cookie_t cookie; spin_lock_bh(&td_chan->lock); - - cookie = txd->chan->cookie; - if (++cookie < 0) - cookie = 1; - txd->chan->cookie = cookie; - txd->cookie = cookie; + cookie = dma_cookie_assign(txd); if (list_empty(&td_chan->active_list)) { dev_dbg(chan2dev(txd->chan), "%s: started %u\n", __func__, diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c index db6d809d4d04..66f8fca1bd3c 100644 --- a/drivers/dma/txx9dmac.c +++ b/drivers/dma/txx9dmac.c @@ -281,21 +281,6 @@ static void txx9dmac_desc_put(struct txx9dmac_chan *dc, } } -/* Called with dc->lock held and bh disabled */ -static dma_cookie_t -txx9dmac_assign_cookie(struct txx9dmac_chan *dc, struct txx9dmac_desc *desc) -{ - dma_cookie_t cookie = dc->chan.cookie; - - if (++cookie < 0) - cookie = 1; - - dc->chan.cookie = cookie; - desc->txd.cookie = cookie; - - return cookie; -} - /*----------------------------------------------------------------------*/ static void txx9dmac_dump_regs(struct txx9dmac_chan *dc) @@ -740,7 +725,7 @@ static dma_cookie_t txx9dmac_tx_submit(struct dma_async_tx_descriptor *tx) dma_cookie_t cookie; spin_lock_bh(&dc->lock); - cookie = txx9dmac_assign_cookie(dc, desc); + cookie = dma_cookie_assign(tx); dev_vdbg(chan2dev(tx->chan), "tx_submit: queued %u %p\n", desc->txd.cookie, desc); -- cgit v1.2.3 From f7fbce07c6ce26a25b4e0cb5f241c361fde87901 Mon Sep 17 00:00:00 2001 From: Russell King - ARM Linux Date: Tue, 6 Mar 2012 22:35:07 +0000 Subject: 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: Russell King Tested-by: Linus Walleij Reviewed-by: Linus Walleij Acked-by: Jassi Brar [imx-sdma.c & mxs-dma.c] Tested-by: Shawn Guo Signed-off-by: Vinod Koul --- drivers/dma/amba-pl08x.c | 2 +- drivers/dma/at_hdmac.c | 2 +- drivers/dma/coh901318.c | 2 +- drivers/dma/dmaengine.h | 18 ++++++++++++++++++ drivers/dma/dw_dmac.c | 2 +- drivers/dma/ep93xx_dma.c | 2 +- drivers/dma/fsldma.c | 2 +- drivers/dma/imx-dma.c | 2 +- drivers/dma/imx-sdma.c | 2 +- drivers/dma/intel_mid_dma.c | 2 +- drivers/dma/ioat/dma.c | 3 +-- drivers/dma/ioat/dma_v2.c | 3 +-- drivers/dma/ioat/dma_v3.c | 3 +-- drivers/dma/ipu/ipu_idmac.c | 2 +- drivers/dma/mxs-dma.c | 2 +- drivers/dma/pl330.c | 2 +- drivers/dma/ste_dma40.c | 2 +- drivers/dma/timb_dma.c | 2 +- drivers/dma/txx9dmac.c | 2 +- 19 files changed, 36 insertions(+), 21 deletions(-) (limited to 'drivers/dma/pl330.c') diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index d8d3dc273f29..346327572cfb 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -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 */ diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index df47e7d6164b..b2826304da24 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -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); diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index 843a1a3b8a81..24837d700951 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c @@ -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); diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h index 7692c8644045..47e099772b8e 100644 --- a/drivers/dma/dmaengine.h +++ b/drivers/dma/dmaengine.h @@ -5,6 +5,7 @@ #ifndef DMAENGINE_H #define DMAENGINE_H +#include #include /** @@ -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 diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index 3a4ca67ace02..12ea60b2a1be 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c @@ -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; diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index e5aaae87ddfb..1c56f75d9faf 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c @@ -703,7 +703,7 @@ static void ep93xx_dma_tasklet(unsigned long data) desc = ep93xx_dma_get_active(edmac); if (desc) { if (desc->complete) { - edmac->chan.completed_cookie = desc->txd.cookie; + dma_cookie_complete(&desc->txd); list_splice_init(&edmac->active, &list); } callback = desc->txd.callback; diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 04b4347ba4e9..f36e8b18cba2 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -1081,8 +1081,8 @@ static void dma_do_tasklet(unsigned long data) desc = to_fsl_desc(chan->ld_running.prev); cookie = desc->async_tx.cookie; + dma_cookie_complete(&desc->async_tx); - chan->common.completed_cookie = cookie; chan_dbg(chan, "completed_cookie=%d\n", cookie); } diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 687fc687aaf6..9a3cbac3d695 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -66,7 +66,7 @@ static void imxdma_handle(struct imxdma_channel *imxdmac) { if (imxdmac->desc.callback) imxdmac->desc.callback(imxdmac->desc.callback_param); - imxdmac->chan.completed_cookie = imxdmac->desc.cookie; + dma_cookie_complete(&imxdmac->desc); } static void imxdma_irq_handler(int channel, void *data) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 3f0c002933f3..981071ebd5c8 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -530,7 +530,7 @@ static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac) else sdmac->status = DMA_SUCCESS; - sdmac->chan.completed_cookie = sdmac->desc.cookie; + dma_cookie_complete(&sdmac->desc); if (sdmac->desc.callback) sdmac->desc.callback(sdmac->desc.callback_param); } diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c index e9217c390b76..cee79f6e035d 100644 --- a/drivers/dma/intel_mid_dma.c +++ b/drivers/dma/intel_mid_dma.c @@ -290,7 +290,7 @@ static void midc_descriptor_complete(struct intel_mid_dma_chan *midc, struct intel_mid_dma_lli *llitem; void *param_txd = NULL; - midc->chan.completed_cookie = txd->cookie; + dma_cookie_complete(txd); callback_txd = txd->callback; param_txd = txd->callback_param; diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 5c06117ac682..b0517c86c1bb 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -600,8 +600,7 @@ static void __cleanup(struct ioat_dma_chan *ioat, unsigned long phys_complete) */ dump_desc_dbg(ioat, desc); if (tx->cookie) { - chan->common.completed_cookie = tx->cookie; - tx->cookie = 0; + dma_cookie_complete(tx); ioat_dma_unmap(chan, tx->flags, desc->len, desc->hw); ioat->active -= desc->hw->tx_cnt; if (tx->callback) { diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index 17ecacb70d40..e8e110ff3d96 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c @@ -149,8 +149,7 @@ static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) dump_desc_dbg(ioat, desc); if (tx->cookie) { ioat_dma_unmap(chan, tx->flags, desc->len, desc->hw); - chan->common.completed_cookie = tx->cookie; - tx->cookie = 0; + dma_cookie_complete(tx); if (tx->callback) { tx->callback(tx->callback_param); tx->callback = NULL; diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index d4afac741e8a..1bda46c43bd7 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c @@ -277,9 +277,8 @@ static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) dump_desc_dbg(ioat, desc); tx = &desc->txd; if (tx->cookie) { - chan->common.completed_cookie = tx->cookie; + dma_cookie_complete(tx); ioat3_dma_unmap(ioat, desc, idx + i); - tx->cookie = 0; if (tx->callback) { tx->callback(tx->callback_param); tx->callback = NULL; diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c index d4620c53fd2d..bff9250a59ce 100644 --- a/drivers/dma/ipu/ipu_idmac.c +++ b/drivers/dma/ipu/ipu_idmac.c @@ -1289,7 +1289,7 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id) /* Flip the active buffer - even if update above failed */ ichan->active_buffer = !ichan->active_buffer; if (done) - ichan->dma_chan.completed_cookie = desc->txd.cookie; + dma_cookie_complete(&desc->txd); callback = desc->txd.callback; callback_param = desc->txd.callback_param; diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index 4d3b6ff3050f..5f3492e5d28f 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c @@ -262,7 +262,7 @@ static irqreturn_t mxs_dma_int_handler(int irq, void *dev_id) stat1 &= ~(1 << channel); if (mxs_chan->status == DMA_SUCCESS) - mxs_chan->chan.completed_cookie = mxs_chan->desc.cookie; + dma_cookie_complete(&mxs_chan->desc); /* schedule tasklet on this channel */ tasklet_schedule(&mxs_chan->tasklet); diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 644eb789958b..a81d0a5f8191 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -233,7 +233,7 @@ static void pl330_tasklet(unsigned long data) /* Pick up ripe tomatoes */ list_for_each_entry_safe(desc, _dt, &pch->work_list, node) if (desc->status == DONE) { - pch->chan.completed_cookie = desc->txd.cookie; + dma_cookie_complete(&desc->txd); list_move_tail(&desc->node, &list); } diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 23e2edc4afd4..c2463758fed1 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -1347,7 +1347,7 @@ static void dma_tasklet(unsigned long data) goto err; if (!d40d->cyclic) - d40c->chan.completed_cookie = d40d->txd.cookie; + dma_cookie_complete(&d40d->txd); /* * If terminating a channel pending_tx is set to zero. diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c index b6e83fc27c4e..1845ac9d6e88 100644 --- a/drivers/dma/timb_dma.c +++ b/drivers/dma/timb_dma.c @@ -285,7 +285,7 @@ static void __td_finish(struct timb_dma_chan *td_chan) else iowrite32(0, td_chan->membase + TIMBDMA_OFFS_TX_DLAR); */ - td_chan->chan.completed_cookie = txd->cookie; + dma_cookie_complete(txd); td_chan->ongoing = false; callback = txd->callback; diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c index 66f8fca1bd3c..8a5225bf9bc9 100644 --- a/drivers/dma/txx9dmac.c +++ b/drivers/dma/txx9dmac.c @@ -411,7 +411,7 @@ txx9dmac_descriptor_complete(struct txx9dmac_chan *dc, dev_vdbg(chan2dev(&dc->chan), "descriptor %u %p complete\n", txd->cookie, desc); - dc->chan.completed_cookie = txd->cookie; + dma_cookie_complete(txd); callback = txd->callback; param = txd->callback_param; -- cgit v1.2.3 From 96a2af41c78b1fbb1f567a3486bdc63f7b31c5fd Mon Sep 17 00:00:00 2001 From: Russell King - ARM Linux Date: Tue, 6 Mar 2012 22:35:27 +0000 Subject: dmaengine: consolidate tx_status functions Now that we have the completed cookie in the dma_chan structure, we can consolidate the tx_status functions by providing a function to set the txstate structure and returning the DMA status. We also provide a separate helper to set the residue for cookies which are still in progress. Signed-off-by: Russell King Tested-by: Linus Walleij Reviewed-by: Linus Walleij Acked-by: Jassi Brar [imx-sdma.c & mxs-dma.c] Tested-by: Shawn Guo Signed-off-by: Vinod Koul --- drivers/dma/amba-pl08x.c | 22 ++++------------------ drivers/dma/at_hdmac.c | 18 ++++++------------ drivers/dma/coh901318.c | 13 ++++--------- drivers/dma/dmaengine.h | 31 +++++++++++++++++++++++++++++++ drivers/dma/dw_dmac.c | 19 ++++--------------- drivers/dma/ep93xx_dma.c | 7 +------ drivers/dma/fsldma.c | 11 +++-------- drivers/dma/imx-dma.c | 11 +---------- drivers/dma/intel_mid_dma.c | 19 +++---------------- drivers/dma/ioat/dma.c | 8 +++++--- drivers/dma/ioat/dma.h | 21 --------------------- drivers/dma/ioat/dma_v3.c | 8 +++++--- drivers/dma/iop-adma.c | 16 +++------------- drivers/dma/mpc512x_dma.c | 9 +++------ drivers/dma/mv_xor.c | 14 ++------------ drivers/dma/pch_dma.c | 11 ++--------- drivers/dma/pl330.c | 13 +------------ drivers/dma/ppc4xx/adma.c | 16 ++-------------- drivers/dma/shdma.c | 11 +---------- drivers/dma/sirf-dma.c | 9 +++------ drivers/dma/ste_dma40.c | 14 ++++---------- drivers/dma/timb_dma.c | 11 ++--------- drivers/dma/txx9dmac.c | 16 +++------------- 23 files changed, 93 insertions(+), 235 deletions(-) (limited to 'drivers/dma/pl330.c') diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 346327572cfb..810f696eda4e 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -964,31 +964,17 @@ static enum dma_status pl08x_dma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); - dma_cookie_t last_used; - dma_cookie_t last_complete; enum dma_status ret; - u32 bytesleft = 0; - last_used = plchan->chan.cookie; - last_complete = plchan->chan.completed_cookie; - - ret = dma_async_is_complete(cookie, last_complete, last_used); - if (ret == DMA_SUCCESS) { - dma_set_tx_state(txstate, last_complete, last_used, 0); + ret = dma_cookie_status(chan, cookie, txstate); + if (ret == DMA_SUCCESS) return ret; - } /* * This cookie not complete yet + * Get number of bytes left in the active transactions and queue */ - last_used = plchan->chan.cookie; - last_complete = plchan->chan.completed_cookie; - - /* Get number of bytes left in the active transactions and queue */ - bytesleft = pl08x_getbytes_chan(plchan); - - dma_set_tx_state(txstate, last_complete, last_used, - bytesleft); + dma_set_residue(txstate, pl08x_getbytes_chan(plchan)); if (plchan->state == PL08X_CHAN_PAUSED) return DMA_PAUSED; diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index b2826304da24..8a3297418cf0 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -996,26 +996,20 @@ atc_tx_status(struct dma_chan *chan, spin_lock_irqsave(&atchan->lock, flags); - last_complete = chan->completed_cookie; - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, last_complete, last_used); + ret = dma_cookie_status(chan, cookie, txstate); if (ret != DMA_SUCCESS) { atc_cleanup_descriptors(atchan); - last_complete = chan->completed_cookie; - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, last_complete, last_used); + ret = dma_cookie_status(chan, cookie, txstate); } + last_complete = chan->completed_cookie; + last_used = chan->cookie; + spin_unlock_irqrestore(&atchan->lock, flags); if (ret != DMA_SUCCESS) - dma_set_tx_state(txstate, last_complete, last_used, - atc_first_active(atchan)->len); - else - dma_set_tx_state(txstate, last_complete, last_used, 0); + dma_set_residue(txstate, atc_first_active(atchan)->len); if (atc_chan_is_paused(atchan)) ret = DMA_PAUSED; diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index 24837d700951..f3505178ff41 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c @@ -1151,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 = chan->completed_cookie; - 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; diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h index 47e099772b8e..1ca5e0e633f4 100644 --- a/drivers/dma/dmaengine.h +++ b/drivers/dma/dmaengine.h @@ -45,4 +45,35 @@ static inline void dma_cookie_complete(struct dma_async_tx_descriptor *tx) tx->cookie = 0; } +/** + * dma_cookie_status - report cookie status + * @chan: dma channel + * @cookie: cookie we are interested in + * @state: dma_tx_state structure to return last/used cookies + * + * Report the status of the cookie, filling in the state structure if + * non-NULL. No locking is required. + */ +static inline enum dma_status dma_cookie_status(struct dma_chan *chan, + dma_cookie_t cookie, struct dma_tx_state *state) +{ + dma_cookie_t used, complete; + + used = chan->cookie; + complete = chan->completed_cookie; + barrier(); + if (state) { + state->last = complete; + state->used = used; + state->residue = 0; + } + return dma_async_is_complete(cookie, complete, used); +} + +static inline void dma_set_residue(struct dma_tx_state *state, u32 residue) +{ + if (state) + state->residue = residue; +} + #endif diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index 12ea60b2a1be..33bde5da850d 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c @@ -979,28 +979,17 @@ dwc_tx_status(struct dma_chan *chan, struct dma_tx_state *txstate) { struct dw_dma_chan *dwc = to_dw_dma_chan(chan); - dma_cookie_t last_used; - dma_cookie_t last_complete; - int ret; + enum dma_status ret; - last_complete = chan->completed_cookie; - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, last_complete, last_used); + ret = dma_cookie_status(chan, cookie, txstate); if (ret != DMA_SUCCESS) { dwc_scan_descriptors(to_dw_dma(chan->device), dwc); - last_complete = chan->completed_cookie; - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, last_complete, last_used); + ret = dma_cookie_status(chan, cookie, txstate); } if (ret != DMA_SUCCESS) - dma_set_tx_state(txstate, last_complete, last_used, - dwc_first_active(dwc)->len); - else - dma_set_tx_state(txstate, last_complete, last_used, 0); + dma_set_residue(txstate, dwc_first_active(dwc)->len); if (dwc->paused) return DMA_PAUSED; diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index 1c56f75d9faf..142ebf0cd316 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c @@ -1241,18 +1241,13 @@ static enum dma_status ep93xx_dma_tx_status(struct dma_chan *chan, struct dma_tx_state *state) { struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan); - dma_cookie_t last_used, last_completed; enum dma_status ret; unsigned long flags; spin_lock_irqsave(&edmac->lock, flags); - last_used = chan->cookie; - last_completed = chan->completed_cookie; + ret = dma_cookie_status(chan, cookie, state); spin_unlock_irqrestore(&edmac->lock, flags); - ret = dma_async_is_complete(cookie, last_completed, last_used); - dma_set_tx_state(state, last_completed, last_used, 0); - return ret; } diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index f36e8b18cba2..2f6c806126e2 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -978,19 +978,14 @@ static enum dma_status fsl_tx_status(struct dma_chan *dchan, struct dma_tx_state *txstate) { struct fsldma_chan *chan = to_fsl_chan(dchan); - dma_cookie_t last_complete; - dma_cookie_t last_used; + enum dma_status ret; unsigned long flags; spin_lock_irqsave(&chan->desc_lock, flags); - - last_complete = dchan->completed_cookie; - last_used = dchan->cookie; - + ret = dma_cookie_status(dchan, cookie, txstate); spin_unlock_irqrestore(&chan->desc_lock, flags); - dma_set_tx_state(txstate, last_complete, last_used, 0); - return dma_async_is_complete(cookie, last_complete, last_used); + return ret; } /*----------------------------------------------------------------------------*/ diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 9a3cbac3d695..6731f1918c55 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -153,16 +153,7 @@ static enum dma_status imxdma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { - struct imxdma_channel *imxdmac = to_imxdma_chan(chan); - dma_cookie_t last_used; - enum dma_status ret; - - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, chan->completed_cookie, last_used); - dma_set_tx_state(txstate, chan->completed_cookie, last_used, 0); - - return ret; + return dma_cookie_status(chan, cookie, txstate); } static dma_cookie_t imxdma_tx_submit(struct dma_async_tx_descriptor *tx) diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c index cee79f6e035d..c9ab4ac18e41 100644 --- a/drivers/dma/intel_mid_dma.c +++ b/drivers/dma/intel_mid_dma.c @@ -477,30 +477,17 @@ static enum dma_status intel_mid_dma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { - dma_cookie_t last_used; - dma_cookie_t last_complete; - int ret; + enum dma_status ret; - last_complete = chan->completed_cookie; - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, last_complete, last_used); + ret = dma_cookie_status(chan, cookie, txstate); if (ret != DMA_SUCCESS) { spin_lock_bh(&midc->lock); midc_scan_descriptors(to_middma_device(chan->device), midc); spin_unlock_bh(&midc->lock); - last_complete = chan->completed_cookie; - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, last_complete, last_used); + ret = dma_cookie_status(chan, cookie, txstate); } - if (txstate) { - txstate->last = last_complete; - txstate->used = last_used; - txstate->residue = 0; - } return ret; } diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index b0517c86c1bb..97e100ce43eb 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -729,13 +729,15 @@ ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, { struct ioat_chan_common *chan = to_chan_common(c); struct ioatdma_device *device = chan->device; + enum dma_status ret; - if (ioat_tx_status(c, cookie, txstate) == DMA_SUCCESS) - return DMA_SUCCESS; + ret = dma_cookie_status(c, cookie, txstate); + if (ret == DMA_SUCCESS) + return ret; device->cleanup_fn((unsigned long) c); - return ioat_tx_status(c, cookie, txstate); + return dma_cookie_status(c, cookie, txstate); } static void ioat1_dma_start_null_desc(struct ioat_dma_chan *ioat) diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index 9653b6b6a715..c7888bccd974 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h @@ -142,27 +142,6 @@ static inline struct ioat_dma_chan *to_ioat_chan(struct dma_chan *c) return container_of(chan, struct ioat_dma_chan, base); } -/** - * ioat_tx_status - poll the status of an ioat transaction - * @c: channel handle - * @cookie: transaction identifier - * @txstate: if set, updated with the transaction state - */ -static inline enum dma_status -ioat_tx_status(struct dma_chan *c, dma_cookie_t cookie, - struct dma_tx_state *txstate) -{ - dma_cookie_t last_used; - dma_cookie_t last_complete; - - last_used = c->cookie; - last_complete = c->completed_cookie; - - dma_set_tx_state(txstate, last_complete, last_used, 0); - - return dma_async_is_complete(cookie, last_complete, last_used); -} - /* wrapper around hardware descriptor format + additional software fields */ /** diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 1bda46c43bd7..145eda241dee 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c @@ -410,13 +410,15 @@ ioat3_tx_status(struct dma_chan *c, dma_cookie_t cookie, struct dma_tx_state *txstate) { struct ioat2_dma_chan *ioat = to_ioat2_chan(c); + enum dma_status ret; - if (ioat_tx_status(c, cookie, txstate) == DMA_SUCCESS) - return DMA_SUCCESS; + ret = dma_cookie_status(c, cookie, txstate); + if (ret == DMA_SUCCESS) + return ret; ioat3_cleanup(ioat); - return ioat_tx_status(c, cookie, txstate); + return dma_cookie_status(c, cookie, txstate); } static struct dma_async_tx_descriptor * diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index f2392d59568d..b1e3be089c52 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c @@ -894,24 +894,14 @@ static enum dma_status iop_adma_status(struct dma_chan *chan, struct dma_tx_state *txstate) { struct iop_adma_chan *iop_chan = to_iop_adma_chan(chan); - dma_cookie_t last_used; - dma_cookie_t last_complete; - enum dma_status ret; - - last_used = chan->cookie; - last_complete = chan->completed_cookie; - dma_set_tx_state(txstate, last_complete, last_used, 0); - ret = dma_async_is_complete(cookie, last_complete, last_used); + + ret = dma_cookie_status(chan, cookie, txstate); if (ret == DMA_SUCCESS) return ret; iop_adma_slot_cleanup(iop_chan); - last_used = chan->cookie; - last_complete = chan->completed_cookie; - dma_set_tx_state(txstate, last_complete, last_used, 0); - - return dma_async_is_complete(cookie, last_complete, last_used); + return dma_cookie_status(chan, cookie, txstate); } static irqreturn_t iop_adma_eot_handler(int irq, void *data) diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c index 0253d5aecdb1..138271591ae9 100644 --- a/drivers/dma/mpc512x_dma.c +++ b/drivers/dma/mpc512x_dma.c @@ -557,17 +557,14 @@ mpc_dma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan); + enum dma_status ret; unsigned long flags; - dma_cookie_t last_used; - dma_cookie_t last_complete; spin_lock_irqsave(&mchan->lock, flags); - last_used = mchan->chan.cookie; - last_complete = mchan->chan.completed_cookie; + ret = dma_cookie_status(chan, cookie, txstate); spin_unlock_irqrestore(&mchan->lock, flags); - dma_set_tx_state(txstate, last_complete, last_used, 0); - return dma_async_is_complete(cookie, last_complete, last_used); + return ret; } /* Prepare descriptor for memory to memory copy */ diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index d9810ce3794c..486353e60a0a 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -810,26 +810,16 @@ static enum dma_status mv_xor_status(struct dma_chan *chan, struct dma_tx_state *txstate) { struct mv_xor_chan *mv_chan = to_mv_xor_chan(chan); - dma_cookie_t last_used; - dma_cookie_t last_complete; enum dma_status ret; - last_used = chan->cookie; - last_complete = chan->completed_cookie; - dma_set_tx_state(txstate, last_complete, last_used, 0); - - ret = dma_async_is_complete(cookie, last_complete, last_used); + ret = dma_cookie_status(chan, cookie, txstate); if (ret == DMA_SUCCESS) { mv_xor_clean_completed_slots(mv_chan); return ret; } mv_xor_slot_cleanup(mv_chan); - last_used = chan->cookie; - last_complete = chan->completed_cookie; - - dma_set_tx_state(txstate, last_complete, last_used, 0); - return dma_async_is_complete(cookie, last_complete, last_used); + return dma_cookie_status(chan, cookie, txstate); } static void mv_dump_xor_regs(struct mv_xor_chan *chan) diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c index 5218e48aed0e..c30f63ee32c5 100644 --- a/drivers/dma/pch_dma.c +++ b/drivers/dma/pch_dma.c @@ -565,19 +565,12 @@ static enum dma_status pd_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { struct pch_dma_chan *pd_chan = to_pd_chan(chan); - dma_cookie_t last_used; - dma_cookie_t last_completed; - int ret; + enum dma_status ret; spin_lock_irq(&pd_chan->lock); - last_completed = chan->completed_cookie; - last_used = chan->cookie; + ret = dma_cookie_status(chan, cookie, txstate); spin_unlock_irq(&pd_chan->lock); - ret = dma_async_is_complete(cookie, last_completed, last_used); - - dma_set_tx_state(txstate, last_completed, last_used, 0); - return ret; } diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index a81d0a5f8191..d43019fc3496 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -395,18 +395,7 @@ static enum dma_status pl330_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { - struct dma_pl330_chan *pch = to_pchan(chan); - dma_cookie_t last_done, last_used; - int ret; - - last_done = chan->completed_cookie; - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, last_done, last_used); - - dma_set_tx_state(txstate, last_done, last_used, 0); - - return ret; + return dma_cookie_status(chan, cookie, txstate); } static void pl330_issue_pending(struct dma_chan *chan) diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c index 12e94dd6fc3d..86239ea01898 100644 --- a/drivers/dma/ppc4xx/adma.c +++ b/drivers/dma/ppc4xx/adma.c @@ -3928,28 +3928,16 @@ static enum dma_status ppc440spe_adma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { struct ppc440spe_adma_chan *ppc440spe_chan; - dma_cookie_t last_used; - dma_cookie_t last_complete; enum dma_status ret; ppc440spe_chan = to_ppc440spe_adma_chan(chan); - last_used = chan->cookie; - last_complete = chan->completed_cookie; - - dma_set_tx_state(txstate, last_complete, last_used, 0); - - ret = dma_async_is_complete(cookie, last_complete, last_used); + ret = dma_cookie_status(chan, cookie, txstate); if (ret == DMA_SUCCESS) return ret; ppc440spe_adma_slot_cleanup(ppc440spe_chan); - last_used = chan->cookie; - last_complete = chan->completed_cookie; - - dma_set_tx_state(txstate, last_complete, last_used, 0); - - return dma_async_is_complete(cookie, last_complete, last_used); + return dma_cookie_status(chan, cookie, txstate); } /** diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index 96d0a4fe8dd9..50510ef7db72 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c @@ -879,23 +879,14 @@ static enum dma_status sh_dmae_tx_status(struct dma_chan *chan, struct dma_tx_state *txstate) { struct sh_dmae_chan *sh_chan = to_sh_chan(chan); - dma_cookie_t last_used; - dma_cookie_t last_complete; enum dma_status status; unsigned long flags; sh_dmae_chan_ld_cleanup(sh_chan, false); - /* First read completed cookie to avoid a skew */ - last_complete = chan->completed_cookie; - rmb(); - last_used = chan->cookie; - BUG_ON(last_complete < 0); - dma_set_tx_state(txstate, last_complete, last_used, 0); - spin_lock_irqsave(&sh_chan->desc_lock, flags); - status = dma_async_is_complete(cookie, last_complete, last_used); + status = dma_cookie_status(chan, cookie, txstate); /* * If we don't find cookie on the queue, it has been aborted and we have diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c index 7bb154a85332..a760d981ece0 100644 --- a/drivers/dma/sirf-dma.c +++ b/drivers/dma/sirf-dma.c @@ -407,16 +407,13 @@ sirfsoc_dma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, { struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan); unsigned long flags; - dma_cookie_t last_used; - dma_cookie_t last_complete; + enum dma_status ret; spin_lock_irqsave(&schan->lock, flags); - last_used = schan->chan.cookie; - last_complete = schan->chan.completed_cookie; + ret = dma_cookie_status(chan, cookie, txstate); spin_unlock_irqrestore(&schan->lock, flags); - dma_set_tx_state(txstate, last_complete, last_used, 0); - return dma_async_is_complete(cookie, last_complete, last_used); + return ret; } static struct dma_async_tx_descriptor *sirfsoc_dma_prep_interleaved( diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index c2463758fed1..07b82e367ffd 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -2332,25 +2332,19 @@ static enum dma_status d40_tx_status(struct dma_chan *chan, struct dma_tx_state *txstate) { struct d40_chan *d40c = container_of(chan, struct d40_chan, chan); - dma_cookie_t last_used; - dma_cookie_t last_complete; - int ret; + enum dma_status ret; if (d40c->phy_chan == NULL) { chan_err(d40c, "Cannot read status of unallocated channel\n"); return -EINVAL; } - last_complete = chan->completed_cookie; - last_used = chan->cookie; + ret = dma_cookie_status(chan, cookie, txstate); + if (ret != DMA_SUCCESS) + dma_set_residue(txstate, stedma40_residue(chan)); if (d40_is_paused(d40c)) ret = DMA_PAUSED; - else - ret = dma_async_is_complete(cookie, last_complete, last_used); - - dma_set_tx_state(txstate, last_complete, last_used, - stedma40_residue(chan)); return ret; } diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c index 1845ac9d6e88..6383abbecce6 100644 --- a/drivers/dma/timb_dma.c +++ b/drivers/dma/timb_dma.c @@ -513,18 +513,11 @@ static enum dma_status td_tx_status(struct dma_chan *chan, dma_cookie_t cookie, { struct timb_dma_chan *td_chan = container_of(chan, struct timb_dma_chan, chan); - dma_cookie_t last_used; - dma_cookie_t last_complete; - int ret; + enum dma_status ret; dev_dbg(chan2dev(chan), "%s: Entry\n", __func__); - last_complete = chan->completed_cookie; - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, last_complete, last_used); - - dma_set_tx_state(txstate, last_complete, last_used, 0); + ret = dma_cookie_status(chan, cookie, txstate); dev_dbg(chan2dev(chan), "%s: exit, ret: %d, last_complete: %d, last_used: %d\n", diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c index 8a5225bf9bc9..bb7b3d96ac6f 100644 --- a/drivers/dma/txx9dmac.c +++ b/drivers/dma/txx9dmac.c @@ -959,27 +959,17 @@ txx9dmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { struct txx9dmac_chan *dc = to_txx9dmac_chan(chan); - dma_cookie_t last_used; - dma_cookie_t last_complete; - int ret; + enum dma_status ret; - last_complete = chan->completed_cookie; - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, last_complete, last_used); + ret = dma_cookie_status(chan, cookie, txstate); if (ret != DMA_SUCCESS) { spin_lock_bh(&dc->lock); txx9dmac_scan_descriptors(dc); spin_unlock_bh(&dc->lock); - last_complete = chan->completed_cookie; - last_used = chan->cookie; - - ret = dma_async_is_complete(cookie, last_complete, last_used); + ret = dma_cookie_status(chan, cookie, txstate); } - dma_set_tx_state(txstate, last_complete, last_used, 0); - return ret; } -- cgit v1.2.3 From d3ee98cdcd6198ea1cf75c603178acc8a805b69b Mon Sep 17 00:00:00 2001 From: Russell King - ARM Linux Date: Tue, 6 Mar 2012 22:35:47 +0000 Subject: dmaengine: consolidate initialization of cookies Provide a common function to initialize a channels cookie values. Signed-off-by: Russell King Tested-by: Linus Walleij Reviewed-by: Linus Walleij Acked-by: Jassi Brar [imx-sdma.c & mxs-dma.c] Tested-by: Shawn Guo Signed-off-by: Vinod Koul --- drivers/dma/amba-pl08x.c | 3 +-- drivers/dma/at_hdmac.c | 4 ++-- drivers/dma/coh901318.c | 2 +- drivers/dma/dmaengine.h | 10 ++++++++++ drivers/dma/dw_dmac.c | 4 ++-- drivers/dma/ep93xx_dma.c | 3 +-- drivers/dma/intel_mid_dma.c | 4 ++-- drivers/dma/ipu/ipu_idmac.c | 6 ++---- drivers/dma/mpc512x_dma.c | 3 +-- drivers/dma/pch_dma.c | 4 ++-- drivers/dma/pl330.c | 2 +- drivers/dma/sirf-dma.c | 3 +-- drivers/dma/ste_dma40.c | 2 +- drivers/dma/timb_dma.c | 5 ++--- drivers/dma/txx9dmac.c | 4 ++-- 15 files changed, 31 insertions(+), 28 deletions(-) (limited to 'drivers/dma/pl330.c') diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 810f696eda4e..1b53f2605250 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -1709,8 +1709,7 @@ static int pl08x_dma_init_virtual_channels(struct pl08x_driver_data *pl08x, chan->name); chan->chan.device = dmadev; - chan->chan.cookie = 0; - chan->chan.completed_cookie = 0; + dma_cookie_init(&chan->chan); spin_lock_init(&chan->lock); INIT_LIST_HEAD(&chan->pend_list); diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 8a3297418cf0..5d225ddc7698 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1103,7 +1103,7 @@ static int atc_alloc_chan_resources(struct dma_chan *chan) spin_lock_irqsave(&atchan->lock, flags); atchan->descs_allocated = i; list_splice(&tmp_list, &atchan->free_list); - chan->completed_cookie = chan->cookie = 1; + dma_cookie_init(chan); spin_unlock_irqrestore(&atchan->lock, flags); /* channel parameters */ @@ -1303,7 +1303,7 @@ static int __init at_dma_probe(struct platform_device *pdev) struct at_dma_chan *atchan = &atdma->chan[i]; atchan->chan_common.device = &atdma->dma_common; - atchan->chan_common.cookie = atchan->chan_common.completed_cookie = 1; + dma_cookie_init(&atchan->chan_common); list_add_tail(&atchan->chan_common.device_node, &atdma->dma_common.channels); diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index f3505178ff41..187bb9eef4a2 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c @@ -915,7 +915,7 @@ static int coh901318_alloc_chan_resources(struct dma_chan *chan) coh901318_config(cohc, NULL); cohc->allocated = 1; - chan->completed_cookie = chan->cookie = 1; + dma_cookie_init(chan); spin_unlock_irqrestore(&cohc->lock, flags); diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h index 1ca5e0e633f4..17f983a4e9ba 100644 --- a/drivers/dma/dmaengine.h +++ b/drivers/dma/dmaengine.h @@ -8,6 +8,16 @@ #include #include +/** + * dma_cookie_init - initialize the cookies for a DMA channel + * @chan: dma channel to initialize + */ +static inline void dma_cookie_init(struct dma_chan *chan) +{ + chan->cookie = DMA_MIN_COOKIE; + chan->completed_cookie = DMA_MIN_COOKIE; +} + /** * dma_cookie_assign - assign a DMA engine cookie to the descriptor * @tx: descriptor needing cookie diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index 33bde5da850d..cb173bbdcfdf 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c @@ -1021,7 +1021,7 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan) return -EIO; } - chan->completed_cookie = chan->cookie = 1; + dma_cookie_init(chan); /* * NOTE: some controllers may have additional features that we @@ -1449,7 +1449,7 @@ static int __init dw_probe(struct platform_device *pdev) struct dw_dma_chan *dwc = &dw->chan[i]; dwc->chan.device = &dw->dma; - dwc->chan.cookie = dwc->chan.completed_cookie = 1; + dma_cookie_init(&dwc->chan); if (pdata->chan_allocation_order == CHAN_ALLOCATION_ASCENDING) list_add_tail(&dwc->chan.device_node, &dw->dma.channels); diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index 142ebf0cd316..f25e83bf5678 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c @@ -854,8 +854,7 @@ static int ep93xx_dma_alloc_chan_resources(struct dma_chan *chan) goto fail_clk_disable; spin_lock_irq(&edmac->lock); - edmac->chan.completed_cookie = 1; - edmac->chan.cookie = 1; + dma_cookie_init(&edmac->chan); ret = edmac->edma->hw_setup(edmac); spin_unlock_irq(&edmac->lock); diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c index c9ab4ac18e41..d599d96a57b6 100644 --- a/drivers/dma/intel_mid_dma.c +++ b/drivers/dma/intel_mid_dma.c @@ -867,7 +867,7 @@ static int intel_mid_dma_alloc_chan_resources(struct dma_chan *chan) pm_runtime_put(&mid->pdev->dev); return -EIO; } - chan->completed_cookie = chan->cookie = 1; + dma_cookie_init(chan); spin_lock_bh(&midc->lock); while (midc->descs_allocated < DESCS_PER_CHANNEL) { @@ -1100,7 +1100,7 @@ static int mid_setup_dma(struct pci_dev *pdev) struct intel_mid_dma_chan *midch = &dma->ch[i]; midch->chan.device = &dma->common; - midch->chan.cookie = 1; + dma_cookie_init(&midch->chan); midch->ch_id = dma->chan_base + i; pr_debug("MDMA:Init CH %d, ID %d\n", i, midch->ch_id); diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c index bff9250a59ce..1880274b0850 100644 --- a/drivers/dma/ipu/ipu_idmac.c +++ b/drivers/dma/ipu/ipu_idmac.c @@ -1504,8 +1504,7 @@ static int idmac_alloc_chan_resources(struct dma_chan *chan) BUG_ON(chan->client_count > 1); WARN_ON(ichan->status != IPU_CHANNEL_FREE); - chan->cookie = 1; - chan->completed_cookie = -ENXIO; + dma_cookie_init(chan); ret = ipu_irq_map(chan->chan_id); if (ret < 0) @@ -1633,8 +1632,7 @@ static int __init ipu_idmac_init(struct ipu *ipu) snprintf(ichan->eof_name, sizeof(ichan->eof_name), "IDMAC EOF %d", i); dma_chan->device = &idmac->dma; - dma_chan->cookie = 1; - dma_chan->completed_cookie = -ENXIO; + dma_cookie_init(dma_chan); dma_chan->chan_id = i; list_add_tail(&dma_chan->device_node, &dma->channels); } diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c index 138271591ae9..2ab0a3d0eed5 100644 --- a/drivers/dma/mpc512x_dma.c +++ b/drivers/dma/mpc512x_dma.c @@ -733,8 +733,7 @@ static int __devinit mpc_dma_probe(struct platform_device *op) mchan = &mdma->channels[i]; mchan->chan.device = dma; - mchan->chan.cookie = 1; - mchan->chan.completed_cookie = mchan->chan.cookie; + dma_cookie_init(&mchan->chan); INIT_LIST_HEAD(&mchan->free); INIT_LIST_HEAD(&mchan->prepared); diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c index c30f63ee32c5..c93bb0459972 100644 --- a/drivers/dma/pch_dma.c +++ b/drivers/dma/pch_dma.c @@ -531,7 +531,7 @@ static int pd_alloc_chan_resources(struct dma_chan *chan) spin_lock_irq(&pd_chan->lock); list_splice(&tmp_list, &pd_chan->free_list); pd_chan->descs_allocated = i; - chan->completed_cookie = chan->cookie = 1; + dma_cookie_init(chan); spin_unlock_irq(&pd_chan->lock); pdc_enable_irq(chan, 1); @@ -912,7 +912,7 @@ static int __devinit pch_dma_probe(struct pci_dev *pdev, struct pch_dma_chan *pd_chan = &pd->channels[i]; pd_chan->chan.device = &pd->dma; - pd_chan->chan.cookie = 1; + dma_cookie_init(&pd_chan->chan); pd_chan->membase = ®s->desc[i]; diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index d43019fc3496..7d6d7b416f68 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -304,7 +304,7 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan) spin_lock_irqsave(&pch->lock, flags); - chan->completed_cookie = chan->cookie = 1; + dma_cookie_init(chan); pch->cyclic = false; pch->pl330_chid = pl330_request_channel(&pdmac->pif); diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c index a760d981ece0..a2cde8585239 100644 --- a/drivers/dma/sirf-dma.c +++ b/drivers/dma/sirf-dma.c @@ -625,8 +625,7 @@ static int __devinit sirfsoc_dma_probe(struct platform_device *op) schan = &sdma->channels[i]; schan->chan.device = dma; - schan->chan.cookie = 1; - schan->chan.completed_cookie = schan->chan.cookie; + dma_cookie_init(&schan->chan); INIT_LIST_HEAD(&schan->free); INIT_LIST_HEAD(&schan->prepared); diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 07b82e367ffd..1ea6d02d08ab 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -2172,7 +2172,7 @@ static int d40_alloc_chan_resources(struct dma_chan *chan) bool is_free_phy; spin_lock_irqsave(&d40c->lock, flags); - chan->completed_cookie = chan->cookie = 1; + dma_cookie_init(chan); /* If no dma configuration is set use default configuration (memcpy) */ if (!d40c->configured) { diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c index 6383abbecce6..7805996661b8 100644 --- a/drivers/dma/timb_dma.c +++ b/drivers/dma/timb_dma.c @@ -477,8 +477,7 @@ static int td_alloc_chan_resources(struct dma_chan *chan) } spin_lock_bh(&td_chan->lock); - chan->completed_cookie = 1; - chan->cookie = 1; + dma_cookie_init(chan); spin_unlock_bh(&td_chan->lock); return 0; @@ -755,7 +754,7 @@ static int __devinit td_probe(struct platform_device *pdev) } td_chan->chan.device = &td->dma; - td_chan->chan.cookie = 1; + dma_cookie_init(&td_chan->chan); spin_lock_init(&td_chan->lock); INIT_LIST_HEAD(&td_chan->active_list); INIT_LIST_HEAD(&td_chan->queue); diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c index bb7b3d96ac6f..40440f946385 100644 --- a/drivers/dma/txx9dmac.c +++ b/drivers/dma/txx9dmac.c @@ -1034,7 +1034,7 @@ static int txx9dmac_alloc_chan_resources(struct dma_chan *chan) return -EIO; } - chan->completed_cookie = chan->cookie = 1; + dma_cookie_init(chan); dc->ccr = TXX9_DMA_CCR_IMMCHN | TXX9_DMA_CCR_INTENE | CCR_LE; txx9dmac_chan_set_SMPCHN(dc); @@ -1163,7 +1163,7 @@ static int __init txx9dmac_chan_probe(struct platform_device *pdev) dc->ddev->chan[ch] = dc; dc->chan.device = &dc->dma; list_add_tail(&dc->chan.device_node, &dc->chan.device->channels); - dc->chan.cookie = dc->chan.completed_cookie = 1; + dma_cookie_init(&dc->chan); if (is_dmac64(dc)) dc->ch_regs = &__txx9dmac_regs(dc->ddev)->CHAN[ch]; -- cgit v1.2.3 From 8867bd508f88eae8b9c54394f17422f49e387b26 Mon Sep 17 00:00:00 2001 From: Vinod Koul Date: Tue, 13 Mar 2012 11:56:44 +0530 Subject: dmaengine: pl330: fix the pl330 build after cookie cleanup drivers/dma/pl330.c: In function 'pl330_control': drivers/dma/pl330.c:342: error: 'struct dma_pl330_chan' has no member named 'completed' Reported by: Jassi Brar Suggested by: Jassi Brar Signed-off-by: Vinod Koul --- drivers/dma/pl330.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/dma/pl330.c') diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 7d6d7b416f68..0bb332c1ccb0 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -339,7 +339,6 @@ static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned /* Mark all desc done */ list_for_each_entry_safe(desc, _dt, &pch->work_list , node) { desc->status = DONE; - pch->completed = desc->txd.cookie; list_move_tail(&desc->node, &list); } -- cgit v1.2.3