aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ioat
diff options
context:
space:
mode:
authorRussell King - ARM Linux <linux@arm.linux.org.uk>2012-03-06 17:35:27 -0500
committerVinod Koul <vinod.koul@linux.intel.com>2012-03-13 02:07:14 -0400
commit96a2af41c78b1fbb1f567a3486bdc63f7b31c5fd (patch)
treed977c6b2ff1a23dfd523e70315ebe976a3f3f079 /drivers/dma/ioat
parentf7fbce07c6ce26a25b4e0cb5f241c361fde87901 (diff)
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 <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/ioat')
-rw-r--r--drivers/dma/ioat/dma.c8
-rw-r--r--drivers/dma/ioat/dma.h21
-rw-r--r--drivers/dma/ioat/dma_v3.c8
3 files changed, 10 insertions, 27 deletions
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,
729{ 729{
730 struct ioat_chan_common *chan = to_chan_common(c); 730 struct ioat_chan_common *chan = to_chan_common(c);
731 struct ioatdma_device *device = chan->device; 731 struct ioatdma_device *device = chan->device;
732 enum dma_status ret;
732 733
733 if (ioat_tx_status(c, cookie, txstate) == DMA_SUCCESS) 734 ret = dma_cookie_status(c, cookie, txstate);
734 return DMA_SUCCESS; 735 if (ret == DMA_SUCCESS)
736 return ret;
735 737
736 device->cleanup_fn((unsigned long) c); 738 device->cleanup_fn((unsigned long) c);
737 739
738 return ioat_tx_status(c, cookie, txstate); 740 return dma_cookie_status(c, cookie, txstate);
739} 741}
740 742
741static void ioat1_dma_start_null_desc(struct ioat_dma_chan *ioat) 743static 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)
142 return container_of(chan, struct ioat_dma_chan, base); 142 return container_of(chan, struct ioat_dma_chan, base);
143} 143}
144 144
145/**
146 * ioat_tx_status - poll the status of an ioat transaction
147 * @c: channel handle
148 * @cookie: transaction identifier
149 * @txstate: if set, updated with the transaction state
150 */
151static inline enum dma_status
152ioat_tx_status(struct dma_chan *c, dma_cookie_t cookie,
153 struct dma_tx_state *txstate)
154{
155 dma_cookie_t last_used;
156 dma_cookie_t last_complete;
157
158 last_used = c->cookie;
159 last_complete = c->completed_cookie;
160
161 dma_set_tx_state(txstate, last_complete, last_used, 0);
162
163 return dma_async_is_complete(cookie, last_complete, last_used);
164}
165
166/* wrapper around hardware descriptor format + additional software fields */ 145/* wrapper around hardware descriptor format + additional software fields */
167 146
168/** 147/**
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,
410 struct dma_tx_state *txstate) 410 struct dma_tx_state *txstate)
411{ 411{
412 struct ioat2_dma_chan *ioat = to_ioat2_chan(c); 412 struct ioat2_dma_chan *ioat = to_ioat2_chan(c);
413 enum dma_status ret;
413 414
414 if (ioat_tx_status(c, cookie, txstate) == DMA_SUCCESS) 415 ret = dma_cookie_status(c, cookie, txstate);
415 return DMA_SUCCESS; 416 if (ret == DMA_SUCCESS)
417 return ret;
416 418
417 ioat3_cleanup(ioat); 419 ioat3_cleanup(ioat);
418 420
419 return ioat_tx_status(c, cookie, txstate); 421 return dma_cookie_status(c, cookie, txstate);
420} 422}
421 423
422static struct dma_async_tx_descriptor * 424static struct dma_async_tx_descriptor *