]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
dma-debug: use offset_in_page() macro
authorGeliang Tang <geliangtang@gmail.com>
Sat, 22 Apr 2017 01:18:05 +0000 (09:18 +0800)
committerVinod Koul <vinod.koul@intel.com>
Mon, 24 Apr 2017 13:10:04 +0000 (18:40 +0530)
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>
lib/dma-debug.c

index b157b46cc9a69ca830a2cdbc8abcbc9baab4a63e..cd5a5a426ef1f219e5091bacb77849c510d62241 100644 (file)
@@ -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,