diff mbox

[v3,3/4] dmatest: add dmaengine_slave_config for DMA_MEMCPY

Message ID 1344917519-9505-4-git-send-email-zhangfei.gao@marvell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhangfei Gao Aug. 14, 2012, 4:11 a.m. UTC
Set direction to DMA_MEM_TO_MEM
DMA driver may require such configure info

Signed-off-by: Zhangfei Gao <zhangfei.gao@marvell.com>
---
 drivers/dma/dmatest.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

Russell King - ARM Linux Aug. 14, 2012, 8:20 a.m. UTC | #1
On Tue, Aug 14, 2012 at 12:11:58PM +0800, Zhangfei Gao wrote:
> Set direction to DMA_MEM_TO_MEM
> DMA driver may require such configure info

No, this is wrong.  By default, any channel being asked to do memcpy
should deal with the channel configuration itself and not require it
to be set - otherwise this breaks the async_tx API.

So consider that dma-test found a bug in your driver which needs fixing.
Zhangfei Gao Aug. 15, 2012, 7:29 a.m. UTC | #2
On Tue, Aug 14, 2012 at 4:20 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Tue, Aug 14, 2012 at 12:11:58PM +0800, Zhangfei Gao wrote:
>> Set direction to DMA_MEM_TO_MEM
>> DMA driver may require such configure info
>
> No, this is wrong.  By default, any channel being asked to do memcpy
> should deal with the channel configuration itself and not require it
> to be set - otherwise this breaks the async_tx API.
>
> So consider that dma-test found a bug in your driver which needs fixing.

Thanks Russell for the info.

Really not know DMA_MEM_TO_MEM should be set as default.
From include/linux/dmaengine.h only find "DMA_ASYNC_TX capability
is automatically set as dma devices are registered".

Will change driver and set config as DMA_MEM_TO_MEM as default setting.

Thanks
diff mbox

Patch

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 24225f0..73bab68 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -261,6 +261,9 @@  static int dmatest_func(void *data)
 	int			src_cnt;
 	int			dst_cnt;
 	int			i;
+	struct dma_slave_config conf = {
+		.direction = DMA_MEM_TO_MEM,
+	};
 
 	thread_name = current->comm;
 	set_freezable();
@@ -361,6 +364,7 @@  static int dmatest_func(void *data)
 						     DMA_BIDIRECTIONAL);
 		}
 
+		dmaengine_slave_config(chan, &conf);
 
 		if (thread->type == DMA_MEMCPY)
 			tx = dev->device_prep_dma_memcpy(chan,