diff options
author | Geliang Tang <geliangtang@gmail.com> | 2017-04-21 21:18:05 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2017-04-24 09:10:04 -0400 |
commit | e57d05520f9c89cf7616fc8c65dafb1ceb7a4c63 (patch) | |
tree | b02d50f421b79ebc7f33aedd09f663e083924f88 /lib/dma-debug.c | |
parent | b70e52cacb3bff1cc6fae36a89e0fa9d33fe31a7 (diff) |
dma-debug: use offset_in_page() macro
Use offset_in_page() macro instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r-- | lib/dma-debug.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index b157b46cc9a6..cd5a5a426ef1 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, | |||
1502 | entry->type = dma_debug_coherent; | 1502 | entry->type = dma_debug_coherent; |
1503 | entry->dev = dev; | 1503 | entry->dev = dev; |
1504 | entry->pfn = page_to_pfn(virt_to_page(virt)); | 1504 | entry->pfn = page_to_pfn(virt_to_page(virt)); |
1505 | entry->offset = (size_t) virt & ~PAGE_MASK; | 1505 | entry->offset = offset_in_page(virt); |
1506 | entry->size = size; | 1506 | entry->size = size; |
1507 | entry->dev_addr = dma_addr; | 1507 | entry->dev_addr = dma_addr; |
1508 | entry->direction = DMA_BIDIRECTIONAL; | 1508 | entry->direction = DMA_BIDIRECTIONAL; |
@@ -1518,7 +1518,7 @@ void debug_dma_free_coherent(struct device *dev, size_t size, | |||
1518 | .type = dma_debug_coherent, | 1518 | .type = dma_debug_coherent, |
1519 | .dev = dev, | 1519 | .dev = dev, |
1520 | .pfn = page_to_pfn(virt_to_page(virt)), | 1520 | .pfn = page_to_pfn(virt_to_page(virt)), |
1521 | .offset = (size_t) virt & ~PAGE_MASK, | 1521 | .offset = offset_in_page(virt), |
1522 | .dev_addr = addr, | 1522 | .dev_addr = addr, |
1523 | .size = size, | 1523 | .size = size, |
1524 | .direction = DMA_BIDIRECTIONAL, | 1524 | .direction = DMA_BIDIRECTIONAL, |