aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/async_tx/async_xor.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/async_tx/async_xor.c')
-rw-r--r--crypto/async_tx/async_xor.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/crypto/async_tx/async_xor.c b/crypto/async_tx/async_xor.c
index 716885a87f07..cb41e6bbbc4d 100644
--- a/crypto/async_tx/async_xor.c
+++ b/crypto/async_tx/async_xor.c
@@ -42,23 +42,17 @@ do_async_xor(struct dma_async_tx_descriptor *tx, struct dma_device *device,
42 dma_async_tx_callback cb_fn, void *cb_param) 42 dma_async_tx_callback cb_fn, void *cb_param)
43{ 43{
44 dma_addr_t dma_addr; 44 dma_addr_t dma_addr;
45 enum dma_data_direction dir;
46 int i; 45 int i;
47 46
48 pr_debug("%s: len: %zu\n", __FUNCTION__, len); 47 pr_debug("%s: len: %zu\n", __FUNCTION__, len);
49 48
50 dir = (flags & ASYNC_TX_ASSUME_COHERENT) ? 49 dma_addr = dma_map_page(device->dev, dest, offset, len,
51 DMA_NONE : DMA_FROM_DEVICE; 50 DMA_FROM_DEVICE);
52
53 dma_addr = dma_map_page(device->dev, dest, offset, len, dir);
54 tx->tx_set_dest(dma_addr, tx, 0); 51 tx->tx_set_dest(dma_addr, tx, 0);
55 52
56 dir = (flags & ASYNC_TX_ASSUME_COHERENT) ?
57 DMA_NONE : DMA_TO_DEVICE;
58
59 for (i = 0; i < src_cnt; i++) { 53 for (i = 0; i < src_cnt; i++) {
60 dma_addr = dma_map_page(device->dev, src_list[i], 54 dma_addr = dma_map_page(device->dev, src_list[i],
61 offset, len, dir); 55 offset, len, DMA_TO_DEVICE);
62 tx->tx_set_src(dma_addr, tx, i); 56 tx->tx_set_src(dma_addr, tx, i);
63 } 57 }
64 58
@@ -106,7 +100,7 @@ do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset,
106 * @src_cnt: number of source pages 100 * @src_cnt: number of source pages
107 * @len: length in bytes 101 * @len: length in bytes
108 * @flags: ASYNC_TX_XOR_ZERO_DST, ASYNC_TX_XOR_DROP_DEST, 102 * @flags: ASYNC_TX_XOR_ZERO_DST, ASYNC_TX_XOR_DROP_DEST,
109 * ASYNC_TX_ASSUME_COHERENT, ASYNC_TX_ACK, ASYNC_TX_DEP_ACK 103 * ASYNC_TX_ACK, ASYNC_TX_DEP_ACK
110 * @depend_tx: xor depends on the result of this transaction. 104 * @depend_tx: xor depends on the result of this transaction.
111 * @cb_fn: function to call when the xor completes 105 * @cb_fn: function to call when the xor completes
112 * @cb_param: parameter to pass to the callback routine 106 * @cb_param: parameter to pass to the callback routine
@@ -246,7 +240,7 @@ static int page_is_zero(struct page *p, unsigned int offset, size_t len)
246 * @src_cnt: number of source pages 240 * @src_cnt: number of source pages
247 * @len: length in bytes 241 * @len: length in bytes
248 * @result: 0 if sum == 0 else non-zero 242 * @result: 0 if sum == 0 else non-zero
249 * @flags: ASYNC_TX_ASSUME_COHERENT, ASYNC_TX_ACK, ASYNC_TX_DEP_ACK 243 * @flags: ASYNC_TX_ACK, ASYNC_TX_DEP_ACK
250 * @depend_tx: xor depends on the result of this transaction. 244 * @depend_tx: xor depends on the result of this transaction.
251 * @cb_fn: function to call when the xor completes 245 * @cb_fn: function to call when the xor completes
252 * @cb_param: parameter to pass to the callback routine 246 * @cb_param: parameter to pass to the callback routine
@@ -270,16 +264,12 @@ async_xor_zero_sum(struct page *dest, struct page **src_list,
270 264
271 if (tx) { 265 if (tx) {
272 dma_addr_t dma_addr; 266 dma_addr_t dma_addr;
273 enum dma_data_direction dir;
274 267
275 pr_debug("%s: (async) len: %zu\n", __FUNCTION__, len); 268 pr_debug("%s: (async) len: %zu\n", __FUNCTION__, len);
276 269
277 dir = (flags & ASYNC_TX_ASSUME_COHERENT) ?
278 DMA_NONE : DMA_TO_DEVICE;
279
280 for (i = 0; i < src_cnt; i++) { 270 for (i = 0; i < src_cnt; i++) {
281 dma_addr = dma_map_page(device->dev, src_list[i], 271 dma_addr = dma_map_page(device->dev, src_list[i],
282 offset, len, dir); 272 offset, len, DMA_TO_DEVICE);
283 tx->tx_set_src(dma_addr, tx, i); 273 tx->tx_set_src(dma_addr, tx, i);
284 } 274 }
285 275