diff options
Diffstat (limited to 'drivers/dma/dmatest.c')
| -rw-r--r-- | drivers/dma/dmatest.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index fb7da5141e96..d93017fc7872 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c | |||
| @@ -38,6 +38,11 @@ module_param(max_channels, uint, S_IRUGO); | |||
| 38 | MODULE_PARM_DESC(max_channels, | 38 | MODULE_PARM_DESC(max_channels, |
| 39 | "Maximum number of channels to use (default: all)"); | 39 | "Maximum number of channels to use (default: all)"); |
| 40 | 40 | ||
| 41 | static unsigned int iterations; | ||
| 42 | module_param(iterations, uint, S_IRUGO); | ||
| 43 | MODULE_PARM_DESC(iterations, | ||
| 44 | "Iterations before stopping test (default: infinite)"); | ||
| 45 | |||
| 41 | static unsigned int xor_sources = 3; | 46 | static unsigned int xor_sources = 3; |
| 42 | module_param(xor_sources, uint, S_IRUGO); | 47 | module_param(xor_sources, uint, S_IRUGO); |
| 43 | MODULE_PARM_DESC(xor_sources, | 48 | MODULE_PARM_DESC(xor_sources, |
| @@ -114,7 +119,7 @@ static void dmatest_init_srcs(u8 **bufs, unsigned int start, unsigned int len) | |||
| 114 | buf[i] = PATTERN_SRC | (~i & PATTERN_COUNT_MASK); | 119 | buf[i] = PATTERN_SRC | (~i & PATTERN_COUNT_MASK); |
| 115 | for ( ; i < start + len; i++) | 120 | for ( ; i < start + len; i++) |
| 116 | buf[i] = PATTERN_SRC | PATTERN_COPY | 121 | buf[i] = PATTERN_SRC | PATTERN_COPY |
| 117 | | (~i & PATTERN_COUNT_MASK);; | 122 | | (~i & PATTERN_COUNT_MASK); |
| 118 | for ( ; i < test_buf_size; i++) | 123 | for ( ; i < test_buf_size; i++) |
| 119 | buf[i] = PATTERN_SRC | (~i & PATTERN_COUNT_MASK); | 124 | buf[i] = PATTERN_SRC | (~i & PATTERN_COUNT_MASK); |
| 120 | buf++; | 125 | buf++; |
| @@ -270,7 +275,8 @@ static int dmatest_func(void *data) | |||
| 270 | 275 | ||
| 271 | flags = DMA_CTRL_ACK | DMA_COMPL_SKIP_DEST_UNMAP | DMA_PREP_INTERRUPT; | 276 | flags = DMA_CTRL_ACK | DMA_COMPL_SKIP_DEST_UNMAP | DMA_PREP_INTERRUPT; |
| 272 | 277 | ||
| 273 | while (!kthread_should_stop()) { | 278 | while (!kthread_should_stop() |
| 279 | && !(iterations && total_tests >= iterations)) { | ||
| 274 | struct dma_device *dev = chan->device; | 280 | struct dma_device *dev = chan->device; |
| 275 | struct dma_async_tx_descriptor *tx = NULL; | 281 | struct dma_async_tx_descriptor *tx = NULL; |
| 276 | dma_addr_t dma_srcs[src_cnt]; | 282 | dma_addr_t dma_srcs[src_cnt]; |
| @@ -416,6 +422,13 @@ err_srcbuf: | |||
| 416 | err_srcs: | 422 | err_srcs: |
| 417 | pr_notice("%s: terminating after %u tests, %u failures (status %d)\n", | 423 | pr_notice("%s: terminating after %u tests, %u failures (status %d)\n", |
| 418 | thread_name, total_tests, failed_tests, ret); | 424 | thread_name, total_tests, failed_tests, ret); |
| 425 | |||
| 426 | if (iterations > 0) | ||
| 427 | while (!kthread_should_stop()) { | ||
| 428 | DECLARE_WAIT_QUEUE_HEAD(wait_dmatest_exit); | ||
| 429 | interruptible_sleep_on(&wait_dmatest_exit); | ||
| 430 | } | ||
| 431 | |||
| 419 | return ret; | 432 | return ret; |
| 420 | } | 433 | } |
| 421 | 434 | ||
| @@ -495,11 +508,11 @@ static int dmatest_add_channel(struct dma_chan *chan) | |||
| 495 | 508 | ||
| 496 | if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) { | 509 | if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) { |
| 497 | cnt = dmatest_add_threads(dtc, DMA_MEMCPY); | 510 | cnt = dmatest_add_threads(dtc, DMA_MEMCPY); |
| 498 | thread_count += cnt > 0 ?: 0; | 511 | thread_count += cnt > 0 ? cnt : 0; |
| 499 | } | 512 | } |
| 500 | if (dma_has_cap(DMA_XOR, dma_dev->cap_mask)) { | 513 | if (dma_has_cap(DMA_XOR, dma_dev->cap_mask)) { |
| 501 | cnt = dmatest_add_threads(dtc, DMA_XOR); | 514 | cnt = dmatest_add_threads(dtc, DMA_XOR); |
| 502 | thread_count += cnt > 0 ?: 0; | 515 | thread_count += cnt > 0 ? cnt : 0; |
| 503 | } | 516 | } |
| 504 | 517 | ||
| 505 | pr_info("dmatest: Started %u threads using %s\n", | 518 | pr_info("dmatest: Started %u threads using %s\n", |
