aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/imx-sdma.c
diff options
context:
space:
mode:
authorRussell King - ARM Linux <linux@arm.linux.org.uk>2012-03-06 17:34:46 -0500
committerVinod Koul <vinod.koul@linux.intel.com>2012-03-13 02:06:52 -0400
commit884485e1f12dcd39390f042e772cdbefc9ebb750 (patch)
treea35fccb601c48ae1ea839aa6d62e4f102f7b66c3 /drivers/dma/imx-sdma.c
parentd2ebfb335b0426deb1a4fb14e4e926d81ecd8235 (diff)
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 <rmk+kernel@arm.linux.org.uk> Tested-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Jassi Brar <jassisinghbrar@gmail.com> [imx-sdma.c & mxs-dma.c] Tested-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma/imx-sdma.c')
-rw-r--r--drivers/dma/imx-sdma.c16
1 files changed, 1 insertions, 15 deletions
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:
815 return ret; 815 return ret;
816} 816}
817 817
818static dma_cookie_t sdma_assign_cookie(struct sdma_channel *sdmac)
819{
820 dma_cookie_t cookie = sdmac->chan.cookie;
821
822 if (++cookie < 0)
823 cookie = 1;
824
825 sdmac->chan.cookie = cookie;
826 sdmac->desc.cookie = cookie;
827
828 return cookie;
829}
830
831static struct sdma_channel *to_sdma_chan(struct dma_chan *chan) 818static struct sdma_channel *to_sdma_chan(struct dma_chan *chan)
832{ 819{
833 return container_of(chan, struct sdma_channel, chan); 820 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)
841 828
842 spin_lock_irqsave(&sdmac->lock, flags); 829 spin_lock_irqsave(&sdmac->lock, flags);
843 830
844 cookie = sdma_assign_cookie(sdmac); 831 cookie = dma_cookie_assign(tx);
845 832
846 spin_unlock_irqrestore(&sdmac->lock, flags); 833 spin_unlock_irqrestore(&sdmac->lock, flags);
847 834
@@ -1140,7 +1127,6 @@ static void sdma_issue_pending(struct dma_chan *chan)
1140 struct sdma_engine *sdma = sdmac->sdma; 1127 struct sdma_engine *sdma = sdmac->sdma;
1141 1128
1142 if (sdmac->status == DMA_IN_PROGRESS) 1129 if (sdmac->status == DMA_IN_PROGRESS)
1143 sdma_enable_channel(sdma, sdmac->channel);
1144} 1130}
1145 1131
1146#define SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1 34 1132#define SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1 34