提交 0dd89119 编写于 作者: G Geliang Tang 提交者: Greg Kroah-Hartman

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: NGeliang Tang <geliangtang@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 a2b60670
...@@ -309,14 +309,13 @@ void *dma_common_contiguous_remap(struct page *page, size_t size, ...@@ -309,14 +309,13 @@ void *dma_common_contiguous_remap(struct page *page, size_t size,
int i; int i;
struct page **pages; struct page **pages;
void *ptr; void *ptr;
unsigned long pfn;
pages = kmalloc(sizeof(struct page *) << get_order(size), GFP_KERNEL); pages = kmalloc(sizeof(struct page *) << get_order(size), GFP_KERNEL);
if (!pages) if (!pages)
return NULL; return NULL;
for (i = 0, pfn = page_to_pfn(page); i < (size >> PAGE_SHIFT); i++) for (i = 0; i < (size >> PAGE_SHIFT); i++)
pages[i] = pfn_to_page(pfn + i); pages[i] = nth_page(page, i);
ptr = dma_common_pages_remap(pages, size, vm_flags, prot, caller); ptr = dma_common_pages_remap(pages, size, vm_flags, prot, caller);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册