Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1628713

[PATCH 3/3] dma-debug: use offset_in_page() macro

From Geliang Tang <geliangtang@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 3/3] dma-debug: use offset_in_page() macro
Date 2017-04-22 03:20 +0200
Message-ID <tyRSp-4HI-7@gated-at.bofh.it> (permalink)
References <tyRSp-4HI-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Use offset_in_page() macro instead of open-coding.

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

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index b157b46..cd5a5a4 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -1502,7 +1502,7 @@ void debug_dma_alloc_coherent(struct device *dev, size_t size,
 	entry->type      = dma_debug_coherent;
 	entry->dev       = dev;
 	entry->pfn	 = page_to_pfn(virt_to_page(virt));
-	entry->offset	 = (size_t) virt & ~PAGE_MASK;
+	entry->offset	 = offset_in_page(virt);
 	entry->size      = size;
 	entry->dev_addr  = dma_addr;
 	entry->direction = DMA_BIDIRECTIONAL;
@@ -1518,7 +1518,7 @@ void debug_dma_free_coherent(struct device *dev, size_t size,
 		.type           = dma_debug_coherent,
 		.dev            = dev,
 		.pfn		= page_to_pfn(virt_to_page(virt)),
-		.offset		= (size_t) virt & ~PAGE_MASK,
+		.offset		= offset_in_page(virt),
 		.dev_addr       = addr,
 		.size           = size,
 		.direction      = DMA_BIDIRECTIONAL,
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] dmaengine: dmatest: use offset_in_page() macro Geliang Tang <geliangtang@gmail.com> - 2017-04-22 03:20 +0200
  [PATCH 2/3] dmaengine: mv_xor: use offset_in_page() macro Geliang Tang <geliangtang@gmail.com> - 2017-04-22 03:20 +0200
  [PATCH 3/3] dma-debug: use offset_in_page() macro Geliang Tang <geliangtang@gmail.com> - 2017-04-22 03:20 +0200
  Re: [PATCH 1/3] dmaengine: dmatest: use offset_in_page() macro Vinod Koul <vinod.koul@intel.com> - 2017-04-24 15:10 +0200

csiph-web