Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1608434
| From | Geliang Tang <geliangtang@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] drivers: base: dma-mapping: use nth_page helper |
| Date | 2017-03-24 15:20 +0100 |
| Message-ID | <toyel-2LK-11@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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> --- drivers/base/dma-mapping.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c index efd71cf..51b7061 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); -- 2.9.3
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] drivers: base: dma-mapping: use nth_page helper Geliang Tang <geliangtang@gmail.com> - 2017-03-24 15:20 +0100
[PATCH] mm/page_alloc: use nth_page helper Geliang Tang <geliangtang@gmail.com> - 2017-03-24 15:20 +0100
Re: [PATCH] mm/page_alloc: use nth_page helper Vlastimil Babka <vbabka@suse.cz> - 2017-03-24 18:50 +0100
csiph-web