summaryrefslogtreecommitdiffstats
path: root/drivers/base/dma-mapping.c
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@gmail.com>2017-03-24 15:10:49 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-08 18:26:18 +0200
commit0dd89119614ba7afb6fe901a1760fa2e706cce86 (patch)
treeca2e27934e479f469056b7e94d6100e6720ffce4 /drivers/base/dma-mapping.c
parentDocumentation/ABI: add information about cpu_capacity (diff)
downloadlinux-0dd89119614ba7afb6fe901a1760fa2e706cce86.tar.xz
linux-0dd89119614ba7afb6fe901a1760fa2e706cce86.zip
drivers: base: dma-mapping: use nth_page helper
Use nth_page() helper instead of page_to_pfn() and pfn_to_page() to simplify the code. Signed-off-by: Geliang Tang <geliangtang@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/dma-mapping.c')
-rw-r--r--drivers/base/dma-mapping.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
index efd71cf4fdea..51b7061ff7c0 100644
--- a/drivers/base/dma-mapping.c
+++ b/drivers/base/dma-mapping.c
@@ -309,14 +309,13 @@ void *dma_common_contiguous_remap(struct page *page, size_t size,
int i;
struct page **pages;
void *ptr;
- unsigned long pfn;
pages = kmalloc(sizeof(struct page *) << get_order(size), GFP_KERNEL);
if (!pages)
return NULL;
- for (i = 0, pfn = page_to_pfn(page); i < (size >> PAGE_SHIFT); i++)
- pages[i] = pfn_to_page(pfn + i);
+ for (i = 0; i < (size >> PAGE_SHIFT); i++)
+ pages[i] = nth_page(page, i);
ptr = dma_common_pages_remap(pages, size, vm_flags, prot, caller);