Skip to content

Commit fe046f1

Browse files
soleenjoergroedel
authored andcommitted
iommu/exynos: use page allocation function provided by iommu-pages.h
Convert iommu/exynos-iommu.c to use the new page allocation functions provided in iommu-pages.h. Signed-off-by: Pasha Tatashin <[email protected]> Acked-by: David Rientjes <[email protected]> Acked-by: Marek Szyprowski <[email protected]> Tested-by: Bagas Sanjaya <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 4a0b77e commit fe046f1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/iommu/exynos-iommu.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <linux/pm_runtime.h>
2323
#include <linux/slab.h>
2424

25+
#include "iommu-pages.h"
26+
2527
typedef u32 sysmmu_iova_t;
2628
typedef u32 sysmmu_pte_t;
2729
static struct iommu_domain exynos_identity_domain;
@@ -900,11 +902,11 @@ static struct iommu_domain *exynos_iommu_domain_alloc_paging(struct device *dev)
900902
if (!domain)
901903
return NULL;
902904

903-
domain->pgtable = (sysmmu_pte_t *)__get_free_pages(GFP_KERNEL, 2);
905+
domain->pgtable = iommu_alloc_pages(GFP_KERNEL, 2);
904906
if (!domain->pgtable)
905907
goto err_pgtable;
906908

907-
domain->lv2entcnt = (short *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1);
909+
domain->lv2entcnt = iommu_alloc_pages(GFP_KERNEL, 1);
908910
if (!domain->lv2entcnt)
909911
goto err_counter;
910912

@@ -930,9 +932,9 @@ static struct iommu_domain *exynos_iommu_domain_alloc_paging(struct device *dev)
930932
return &domain->domain;
931933

932934
err_lv2ent:
933-
free_pages((unsigned long)domain->lv2entcnt, 1);
935+
iommu_free_pages(domain->lv2entcnt, 1);
934936
err_counter:
935-
free_pages((unsigned long)domain->pgtable, 2);
937+
iommu_free_pages(domain->pgtable, 2);
936938
err_pgtable:
937939
kfree(domain);
938940
return NULL;
@@ -973,8 +975,8 @@ static void exynos_iommu_domain_free(struct iommu_domain *iommu_domain)
973975
phys_to_virt(base));
974976
}
975977

976-
free_pages((unsigned long)domain->pgtable, 2);
977-
free_pages((unsigned long)domain->lv2entcnt, 1);
978+
iommu_free_pages(domain->pgtable, 2);
979+
iommu_free_pages(domain->lv2entcnt, 1);
978980
kfree(domain);
979981
}
980982

0 commit comments

Comments
 (0)