aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/dmatest.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 24225f0fdcd8..6be893baadd9 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -228,6 +228,20 @@ static void dmatest_callback(void *arg)
228 wake_up_all(done->wait); 228 wake_up_all(done->wait);
229} 229}
230 230
231static inline void unmap_src(struct device *dev, dma_addr_t *addr, size_t len,
232 unsigned int count)
233{
234 while (count--)
235 dma_unmap_single(dev, addr[count], len, DMA_TO_DEVICE);
236}
237
238static inline void unmap_dst(struct device *dev, dma_addr_t *addr, size_t len,
239 unsigned int count)
240{
241 while (count--)
242 dma_unmap_single(dev, addr[count], len, DMA_BIDIRECTIONAL);
243}
244
231/* 245/*
232 * This function repeatedly tests DMA transfers of various lengths and 246 * This function repeatedly tests DMA transfers of various lengths and
233 * offsets for a given operation type until it is told to exit by 247 * offsets for a given operation type until it is told to exit by
@@ -383,13 +397,8 @@ static int dmatest_func(void *data)
383 } 397 }
384 398
385 if (!tx) { 399 if (!tx) {
386 for (i = 0; i < src_cnt; i++) 400 unmap_src(dev->dev, dma_srcs, len, src_cnt);
387 dma_unmap_single(dev->dev, dma_srcs[i], len, 401 unmap_dst(dev->dev, dma_dsts, test_buf_size, dst_cnt);
388 DMA_TO_DEVICE);
389 for (i = 0; i < dst_cnt; i++)
390 dma_unmap_single(dev->dev, dma_dsts[i],
391 test_buf_size,
392 DMA_BIDIRECTIONAL);
393 pr_warning("%s: #%u: prep error with src_off=0x%x " 402 pr_warning("%s: #%u: prep error with src_off=0x%x "
394 "dst_off=0x%x len=0x%x\n", 403 "dst_off=0x%x len=0x%x\n",
395 thread_name, total_tests - 1, 404 thread_name, total_tests - 1,
@@ -443,9 +452,7 @@ static int dmatest_func(void *data)
443 } 452 }
444 453
445 /* Unmap by myself (see DMA_COMPL_SKIP_DEST_UNMAP above) */ 454 /* Unmap by myself (see DMA_COMPL_SKIP_DEST_UNMAP above) */
446 for (i = 0; i < dst_cnt; i++) 455 unmap_dst(dev->dev, dma_dsts, test_buf_size, dst_cnt);
447 dma_unmap_single(dev->dev, dma_dsts[i], test_buf_size,
448 DMA_BIDIRECTIONAL);
449 456
450 error_count = 0; 457 error_count = 0;
451 458