Commit 8d485a69 authored by Robin Murphy's avatar Robin Murphy Committed by Joerg Roedel

iommu/dma: Prune redundant pgprot arguments

Somewhere amongst previous refactorings, the pgprot value in
__iommu_dma_alloc_noncontiguous() became entirely unused, and the one
used in iommu_dma_alloc_remap() can be computed locally rather than by
its one remaining caller. Clean 'em up.
Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/c2a81b72df59a71a13f8bad94f834e627c4c93dd.1717504749.git.robin.murphy@arm.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent b5c29fba
...@@ -939,8 +939,7 @@ static struct page **__iommu_dma_alloc_pages(struct device *dev, ...@@ -939,8 +939,7 @@ static struct page **__iommu_dma_alloc_pages(struct device *dev,
* but an IOMMU which supports smaller pages might not map the whole thing. * but an IOMMU which supports smaller pages might not map the whole thing.
*/ */
static struct page **__iommu_dma_alloc_noncontiguous(struct device *dev, static struct page **__iommu_dma_alloc_noncontiguous(struct device *dev,
size_t size, struct sg_table *sgt, gfp_t gfp, pgprot_t prot, size_t size, struct sg_table *sgt, gfp_t gfp, unsigned long attrs)
unsigned long attrs)
{ {
struct iommu_domain *domain = iommu_get_dma_domain(dev); struct iommu_domain *domain = iommu_get_dma_domain(dev);
struct iommu_dma_cookie *cookie = domain->iova_cookie; struct iommu_dma_cookie *cookie = domain->iova_cookie;
...@@ -1014,15 +1013,14 @@ static struct page **__iommu_dma_alloc_noncontiguous(struct device *dev, ...@@ -1014,15 +1013,14 @@ static struct page **__iommu_dma_alloc_noncontiguous(struct device *dev,
} }
static void *iommu_dma_alloc_remap(struct device *dev, size_t size, static void *iommu_dma_alloc_remap(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t gfp, pgprot_t prot, dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
unsigned long attrs)
{ {
struct page **pages; struct page **pages;
struct sg_table sgt; struct sg_table sgt;
void *vaddr; void *vaddr;
pgprot_t prot = dma_pgprot(dev, PAGE_KERNEL, attrs);
pages = __iommu_dma_alloc_noncontiguous(dev, size, &sgt, gfp, prot, pages = __iommu_dma_alloc_noncontiguous(dev, size, &sgt, gfp, attrs);
attrs);
if (!pages) if (!pages)
return NULL; return NULL;
*dma_handle = sgt.sgl->dma_address; *dma_handle = sgt.sgl->dma_address;
...@@ -1049,8 +1047,7 @@ static struct sg_table *iommu_dma_alloc_noncontiguous(struct device *dev, ...@@ -1049,8 +1047,7 @@ static struct sg_table *iommu_dma_alloc_noncontiguous(struct device *dev,
if (!sh) if (!sh)
return NULL; return NULL;
sh->pages = __iommu_dma_alloc_noncontiguous(dev, size, &sh->sgt, gfp, sh->pages = __iommu_dma_alloc_noncontiguous(dev, size, &sh->sgt, gfp, attrs);
PAGE_KERNEL, attrs);
if (!sh->pages) { if (!sh->pages) {
kfree(sh); kfree(sh);
return NULL; return NULL;
...@@ -1619,8 +1616,7 @@ static void *iommu_dma_alloc(struct device *dev, size_t size, ...@@ -1619,8 +1616,7 @@ static void *iommu_dma_alloc(struct device *dev, size_t size,
if (gfpflags_allow_blocking(gfp) && if (gfpflags_allow_blocking(gfp) &&
!(attrs & DMA_ATTR_FORCE_CONTIGUOUS)) { !(attrs & DMA_ATTR_FORCE_CONTIGUOUS)) {
return iommu_dma_alloc_remap(dev, size, handle, gfp, return iommu_dma_alloc_remap(dev, size, handle, gfp, attrs);
dma_pgprot(dev, PAGE_KERNEL, attrs), attrs);
} }
if (IS_ENABLED(CONFIG_DMA_DIRECT_REMAP) && if (IS_ENABLED(CONFIG_DMA_DIRECT_REMAP) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment