Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1628710 > unrolled thread
| Started by | Geliang Tang <geliangtang@gmail.com> |
|---|---|
| First post | 2017-04-22 03:20 +0200 |
| Last post | 2017-04-24 15:10 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[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
| From | Geliang Tang <geliangtang@gmail.com> |
|---|---|
| Date | 2017-04-22 03:20 +0200 |
| Subject | [PATCH 1/3] dmaengine: dmatest: use offset_in_page() macro |
| Message-ID | <tyRSp-4HI-1@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Geliang Tang <geliangtang@gmail.com> |
|---|---|
| Date | 2017-04-22 03:20 +0200 |
| Subject | [PATCH 2/3] dmaengine: mv_xor: use offset_in_page() macro |
| Message-ID | <tyRSp-4HI-3@gated-at.bofh.it> |
| In reply to | #1628710 |
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
[toc] | [prev] | [next] | [standalone]
| From | Geliang Tang <geliangtang@gmail.com> |
|---|---|
| Date | 2017-04-22 03:20 +0200 |
| Subject | [PATCH 3/3] dma-debug: use offset_in_page() macro |
| Message-ID | <tyRSp-4HI-7@gated-at.bofh.it> |
| In reply to | #1628710 |
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
[toc] | [prev] | [next] | [standalone]
| From | Vinod Koul <vinod.koul@intel.com> |
|---|---|
| Date | 2017-04-24 15:10 +0200 |
| Message-ID | <tzLUC-7pd-15@gated-at.bofh.it> |
| In reply to | #1628710 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web