public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] dmaengine: dmatest: use offset_in_page() macro
@ 2017-04-22  1:18 Geliang Tang
  2017-04-22  1:18 ` [PATCH 2/3] dmaengine: mv_xor: " Geliang Tang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Geliang Tang @ 2017-04-22  1:18 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, Andrew Morton, Ingo Molnar
  Cc: Geliang Tang, dmaengine, linux-kernel

Use offset_in_page() macro instead of open-coding.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 drivers/dma/dmatest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 54d581d..d042b2b 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -585,7 +585,7 @@ static int dmatest_func(void *data)
 		for (i = 0; i < src_cnt; i++) {
 			void *buf = thread->srcs[i];
 			struct page *pg = virt_to_page(buf);
-			unsigned pg_off = (unsigned long) buf & ~PAGE_MASK;
+			unsigned long pg_off = offset_in_page(buf);
 
 			um->addr[i] = dma_map_page(dev->dev, pg, pg_off,
 						   um->len, DMA_TO_DEVICE);
@@ -605,7 +605,7 @@ static int dmatest_func(void *data)
 		for (i = 0; i < dst_cnt; i++) {
 			void *buf = thread->dsts[i];
 			struct page *pg = virt_to_page(buf);
-			unsigned pg_off = (unsigned long) buf & ~PAGE_MASK;
+			unsigned long pg_off = offset_in_page(buf);
 
 			dsts[i] = dma_map_page(dev->dev, pg, pg_off, um->len,
 					       DMA_BIDIRECTIONAL);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-24 13:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-22  1:18 [PATCH 1/3] dmaengine: dmatest: use offset_in_page() macro Geliang Tang
2017-04-22  1:18 ` [PATCH 2/3] dmaengine: mv_xor: " Geliang Tang
2017-04-22  1:18 ` [PATCH 3/3] dma-debug: " Geliang Tang
2017-04-24 13:10 ` [PATCH 1/3] dmaengine: dmatest: " Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox