* [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
* [PATCH 2/3] dmaengine: mv_xor: use offset_in_page() macro
2017-04-22 1:18 [PATCH 1/3] dmaengine: dmatest: use offset_in_page() macro Geliang Tang
@ 2017-04-22 1:18 ` 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
2 siblings, 0 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/mv_xor.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index ea53b87..25bc5b1 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -960,7 +960,7 @@ static int mv_chan_memcpy_self_test(struct mv_xor_chan *mv_chan)
}
src_dma = dma_map_page(dma_chan->device->dev, virt_to_page(src),
- (size_t)src & ~PAGE_MASK, PAGE_SIZE,
+ offset_in_page(src), PAGE_SIZE,
DMA_TO_DEVICE);
unmap->addr[0] = src_dma;
@@ -972,7 +972,7 @@ static int mv_chan_memcpy_self_test(struct mv_xor_chan *mv_chan)
unmap->to_cnt = 1;
dest_dma = dma_map_page(dma_chan->device->dev, virt_to_page(dest),
- (size_t)dest & ~PAGE_MASK, PAGE_SIZE,
+ offset_in_page(dest), PAGE_SIZE,
DMA_FROM_DEVICE);
unmap->addr[1] = dest_dma;
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] dma-debug: use offset_in_page() macro
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 ` Geliang Tang
2017-04-24 13:10 ` [PATCH 1/3] dmaengine: dmatest: " Vinod Koul
2 siblings, 0 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>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] dmaengine: dmatest: use offset_in_page() macro
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 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2017-04-24 13:10 UTC (permalink / raw)
To: Geliang Tang
Cc: Dan Williams, Andrew Morton, Ingo Molnar, dmaengine, linux-kernel
On Sat, Apr 22, 2017 at 09:18:03AM +0800, Geliang Tang wrote:
> Use offset_in_page() macro instead of open-coding.
Applied all, thanks
--
~Vinod
^ permalink raw reply [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;
as well as URLs for NNTP newsgroup(s).