[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a23e2178bef0fea63f24995b5086a0d4ed82061e.1492757182.git.geliangtang@gmail.com>
Date: Sat, 22 Apr 2017 09:18:05 +0800
From: Geliang Tang <geliangtang@...il.com>
To: Dan Williams <dan.j.williams@...el.com>,
Vinod Koul <vinod.koul@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>
Cc: Geliang Tang <geliangtang@...il.com>, dmaengine@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/3] dma-debug: use offset_in_page() macro
Use offset_in_page() macro instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@...il.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
Powered by blists - more mailing lists