]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/etnaviv: iommuv1: fold pgtable_write into callers
authorLucas Stach <l.stach@pengutronix.de>
Thu, 7 Sep 2017 13:56:01 +0000 (15:56 +0200)
committerLucas Stach <l.stach@pengutronix.de>
Tue, 10 Oct 2017 09:35:30 +0000 (11:35 +0200)
A function doing a single assignment is not really helping the
code flow.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-By: Wladimir J. van der Laan <laanwj@gmail.com>
drivers/gpu/drm/etnaviv/etnaviv_iommu.c

index 522f6822abee5b4923ad91bafdb093ba291786ad..33084cbc8b277d269bd165d7452bba87d3f53887 100644 (file)
@@ -50,15 +50,6 @@ static struct etnaviv_iommu_domain *to_etnaviv_domain(struct iommu_domain *domai
        return container_of(domain, struct etnaviv_iommu_domain, domain);
 }
 
-static void pgtable_write(struct etnaviv_iommu_domain_pgtable *pgtable,
-                         unsigned long iova, phys_addr_t paddr)
-{
-       /* calcuate index into page table */
-       unsigned int index = (iova - GPU_MEM_START) / SZ_4K;
-
-       pgtable->pgtable[index] = paddr;
-}
-
 static int __etnaviv_iommu_init(struct etnaviv_iommu_domain *etnaviv_domain)
 {
        u32 *p;
@@ -114,12 +105,13 @@ static int etnaviv_iommuv1_map(struct iommu_domain *domain, unsigned long iova,
           phys_addr_t paddr, size_t size, int prot)
 {
        struct etnaviv_iommu_domain *etnaviv_domain = to_etnaviv_domain(domain);
+       unsigned int index = (iova - GPU_MEM_START) / SZ_4K;
 
        if (size != SZ_4K)
                return -EINVAL;
 
        spin_lock(&etnaviv_domain->map_lock);
-       pgtable_write(&etnaviv_domain->pgtable, iova, paddr);
+       etnaviv_domain->pgtable.pgtable[index] = paddr;
        spin_unlock(&etnaviv_domain->map_lock);
 
        return 0;
@@ -129,13 +121,13 @@ static size_t etnaviv_iommuv1_unmap(struct iommu_domain *domain,
        unsigned long iova, size_t size)
 {
        struct etnaviv_iommu_domain *etnaviv_domain = to_etnaviv_domain(domain);
+       unsigned int index = (iova - GPU_MEM_START) / SZ_4K;
 
        if (size != SZ_4K)
                return -EINVAL;
 
        spin_lock(&etnaviv_domain->map_lock);
-       pgtable_write(&etnaviv_domain->pgtable, iova,
-                     etnaviv_domain->bad_page_dma);
+       etnaviv_domain->pgtable.pgtable[index] = etnaviv_domain->bad_page_dma;
        spin_unlock(&etnaviv_domain->map_lock);
 
        return SZ_4K;