Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358475
b: refs/heads/master
c: 8be9e32
h: refs/heads/master
i:
  358473: 38f0a8a
  358471: f8736a7
v: v3
  • Loading branch information
Akinobu Mita authored and Vinod Koul committed Jan 8, 2013
1 parent e75321e commit f6c6ee4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 91998261dd0d5aefb56d87cef84f7810c32f6194
refs/heads/master: 8be9e32b310cd8c4302991c8ff6692689c7d9d76
16 changes: 13 additions & 3 deletions trunk/drivers/dma/dmatest.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,13 @@ static inline void unmap_dst(struct device *dev, dma_addr_t *addr, size_t len,
dma_unmap_single(dev, addr[count], len, DMA_BIDIRECTIONAL);
}

static unsigned int min_odd(unsigned int x, unsigned int y)
{
unsigned int val = min(x, y);

return val % 2 ? val : val - 1;
}

/*
* This function repeatedly tests DMA transfers of various lengths and
* offsets for a given operation type until it is told to exit by
Expand All @@ -262,6 +269,7 @@ static int dmatest_func(void *data)
struct dmatest_thread *thread = data;
struct dmatest_done done = { .wait = &done_wait };
struct dma_chan *chan;
struct dma_device *dev;
const char *thread_name;
unsigned int src_off, dst_off, len;
unsigned int error_count;
Expand All @@ -283,13 +291,16 @@ static int dmatest_func(void *data)

smp_rmb();
chan = thread->chan;
dev = chan->device;
if (thread->type == DMA_MEMCPY)
src_cnt = dst_cnt = 1;
else if (thread->type == DMA_XOR) {
src_cnt = xor_sources | 1; /* force odd to ensure dst = src */
/* force odd to ensure dst = src */
src_cnt = min_odd(xor_sources | 1, dev->max_xor);
dst_cnt = 1;
} else if (thread->type == DMA_PQ) {
src_cnt = pq_sources | 1; /* force odd to ensure dst = src */
/* force odd to ensure dst = src */
src_cnt = min_odd(pq_sources | 1, dma_maxpq(dev, 0));
dst_cnt = 2;
for (i = 0; i < src_cnt; i++)
pq_coefs[i] = 1;
Expand Down Expand Up @@ -327,7 +338,6 @@ static int dmatest_func(void *data)

while (!kthread_should_stop()
&& !(iterations && total_tests >= iterations)) {
struct dma_device *dev = chan->device;
struct dma_async_tx_descriptor *tx = NULL;
dma_addr_t dma_srcs[src_cnt];
dma_addr_t dma_dsts[dst_cnt];
Expand Down

0 comments on commit f6c6ee4

Please sign in to comment.