All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: dri-devel@lists.freedesktop.org
Cc: patchwork-lst@pengutronix.de, etnaviv@lists.freedesktop.org,
	kernel@pengutronix.de,
	Russell King <linux+etnaviv@armlinux.org.uk>
Subject: [PATCH v2 4/8] drm/etnaviv: iommuv1: fold pgtable_write into callers
Date: Fri, 29 Sep 2017 16:37:00 +0200	[thread overview]
Message-ID: <20170929143704.30635-4-l.stach@pengutronix.de> (raw)
In-Reply-To: <20170929143704.30635-1-l.stach@pengutronix.de>

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 | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
index aaa8c4136f53..790cb7f9d59c 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
@@ -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;
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-09-29 14:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-29 14:36 [PATCH v2 1/8] drm/etnaviv: remove iommu fault handler Lucas Stach
2017-09-29 14:36 ` [PATCH v2 2/8] drm/etnaviv: remove iova_to_phys iommu ops Lucas Stach
2017-09-29 14:36 ` [PATCH v2 3/8] drm/etnaviv: iommuv1: fold pagetable alloc and free into caller Lucas Stach
2017-09-30  5:20   ` kbuild test robot
2017-09-29 14:37 ` Lucas Stach [this message]
2017-09-29 14:37 ` [PATCH v2 5/8] drm/etnaviv: iommuv1: remove map_lock Lucas Stach
2017-09-29 14:37 ` [PATCH v2 6/8] drm/etnaviv: mmu: stop using iommu map/unmap functions Lucas Stach
2017-09-30  7:06   ` kbuild test robot
2017-09-29 14:37 ` [PATCH v2 7/8] drm/etnaviv: mmu: mark local functions static Lucas Stach
2017-09-29 14:37 ` [PATCH v2 8/8] drm/etnaviv: remove IOMMU dependency Lucas Stach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170929143704.30635-4-l.stach@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=kernel@pengutronix.de \
    --cc=linux+etnaviv@armlinux.org.uk \
    --cc=patchwork-lst@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.