From: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
To: linux-kernel@vger.kernel.org
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>,
maciej.sosnowski@intel.com, dan.j.williams@intel.com
Subject: [PATCH] dmaengine: Add Kconfig of DMA data align for DMA Test driver
Date: Thu, 12 Mar 2009 15:30:41 +0900 [thread overview]
Message-ID: <49B8AC11.70902@renesas.com> (raw)
Test drivers of DMA engine usually perform DMA transfer by 1 byte unit.
This can set transfer size of DMA and aligns data for tests.
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
---
drivers/dma/Kconfig | 8 ++++++++
drivers/dma/dmatest.c | 7 +++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 48ea59e..7f9e1ec 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -105,4 +105,12 @@ config DMATEST
Simple DMA test client. Say N unless you're debugging a
DMA Device driver.
+config DMATEST_DATA_ALIGN
+ int "DMA Test data align size"
+ depends on DMATEST
+ default "1"
+ help
+ Test drivers of DMA engine usually perform DMA transfer by 1 byte unit.
+ This can set transfer size of DMA and aligns data for tests.
+
endif
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 732fa1e..e7f273c 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -224,8 +224,15 @@ static int dmatest_func(void *data)
total_tests++;
len = dmatest_random() % test_buf_size + 1;
+#if CONFIG_DMATEST_DATA_ALIGN > 1
+ len -= (len % CONFIG_DMATEST_DATA_ALIGN);
+#endif
src_off = dmatest_random() % (test_buf_size - len + 1);
dst_off = dmatest_random() % (test_buf_size - len + 1);
+#if CONFIG_DMATEST_DATA_ALIGN > 1
+ src_off -= (src_off % CONFIG_DMATEST_DATA_ALIGN);
+ dst_off -= (dst_off % CONFIG_DMATEST_DATA_ALIGN);
+#endif
dmatest_init_srcbuf(thread->srcbuf, src_off, len);
dmatest_init_dstbuf(thread->dstbuf, dst_off, len);
--
1.6.2
next reply other threads:[~2009-03-12 6:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-12 6:30 Nobuhiro Iwamatsu [this message]
2009-03-16 22:02 ` [PATCH] dmaengine: Add Kconfig of DMA data align for DMA Test driver Dan Williams
2009-03-18 12:09 ` Sosnowski, Maciej
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49B8AC11.70902@renesas.com \
--to=iwamatsu.nobuhiro@renesas.com \
--cc=dan.j.williams@intel.com \
--cc=hskinnemoen@atmel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.sosnowski@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox