Skip to content

Commit 8d485a6

Browse files
rmurphy-armjoergroedel
authored andcommitted
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: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/c2a81b72df59a71a13f8bad94f834e627c4c93dd.1717504749.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <[email protected]>
1 parent b5c29fb commit 8d485a6

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

drivers/iommu/dma-iommu.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -939,8 +939,7 @@ static struct page **__iommu_dma_alloc_pages(struct device *dev,
939939
* but an IOMMU which supports smaller pages might not map the whole thing.
940940
*/
941941
static struct page **__iommu_dma_alloc_noncontiguous(struct device *dev,
942-
size_t size, struct sg_table *sgt, gfp_t gfp, pgprot_t prot,
943-
unsigned long attrs)
942+
size_t size, struct sg_table *sgt, gfp_t gfp, unsigned long attrs)
944943
{
945944
struct iommu_domain *domain = iommu_get_dma_domain(dev);
946945
struct iommu_dma_cookie *cookie = domain->iova_cookie;
@@ -1014,15 +1013,14 @@ static struct page **__iommu_dma_alloc_noncontiguous(struct device *dev,
10141013
}
10151014

10161015
static void *iommu_dma_alloc_remap(struct device *dev, size_t size,
1017-
dma_addr_t *dma_handle, gfp_t gfp, pgprot_t prot,
1018-
unsigned long attrs)
1016+
dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
10191017
{
10201018
struct page **pages;
10211019
struct sg_table sgt;
10221020
void *vaddr;
1021+
pgprot_t prot = dma_pgprot(dev, PAGE_KERNEL, attrs);
10231022

1024-
pages = __iommu_dma_alloc_noncontiguous(dev, size, &sgt, gfp, prot,
1025-
attrs);
1023+
pages = __iommu_dma_alloc_noncontiguous(dev, size, &sgt, gfp, attrs);
10261024
if (!pages)
10271025
return NULL;
10281026
*dma_handle = sgt.sgl->dma_address;
@@ -1049,8 +1047,7 @@ static struct sg_table *iommu_dma_alloc_noncontiguous(struct device *dev,
10491047
if (!sh)
10501048
return NULL;
10511049

1052-
sh->pages = __iommu_dma_alloc_noncontiguous(dev, size, &sh->sgt, gfp,
1053-
PAGE_KERNEL, attrs);
1050+
sh->pages = __iommu_dma_alloc_noncontiguous(dev, size, &sh->sgt, gfp, attrs);
10541051
if (!sh->pages) {
10551052
kfree(sh);
10561053
return NULL;
@@ -1619,8 +1616,7 @@ static void *iommu_dma_alloc(struct device *dev, size_t size,
16191616

16201617
if (gfpflags_allow_blocking(gfp) &&
16211618
!(attrs & DMA_ATTR_FORCE_CONTIGUOUS)) {
1622-
return iommu_dma_alloc_remap(dev, size, handle, gfp,
1623-
dma_pgprot(dev, PAGE_KERNEL, attrs), attrs);
1619+
return iommu_dma_alloc_remap(dev, size, handle, gfp, attrs);
16241620
}
16251621

16261622
if (IS_ENABLED(CONFIG_DMA_DIRECT_REMAP) &&

0 commit comments

Comments
 (0)