]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dma-remap: drop nth_page() in dma_common_contiguous_remap()
authorDavid Hildenbrand <david@redhat.com>
Mon, 1 Sep 2025 15:03:44 +0000 (17:03 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:25:35 +0000 (17:25 -0700)
dma_common_contiguous_remap() is used to remap an "allocated contiguous
region".  Within a single allocation, there is no need to use nth_page()
anymore.

Neither the buddy, nor hugetlb, nor CMA will hand out problematic page
ranges.

Link: https://lkml.kernel.org/r/20250901150359.867252-24-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/dma/remap.c

index 9e2afad1c6152fc0ee5fd3479973afe8cc9f5337..b7c1c0c92d0c8dc4055543e54a0c8ea724377afd 100644 (file)
@@ -49,7 +49,7 @@ void *dma_common_contiguous_remap(struct page *page, size_t size,
        if (!pages)
                return NULL;
        for (i = 0; i < count; i++)
-               pages[i] = nth_page(page, i);
+               pages[i] = page++;
        vaddr = vmap(pages, count, VM_DMA_COHERENT, prot);
        kvfree(pages);