public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mdeia: ipu3: ipu33-mmu: Replace macro IPU3_ADDR2PTE() with a function
@ 2023-01-24 13:55 Brent Pappas
  2023-01-24 14:42 ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Brent Pappas @ 2023-01-24 13:55 UTC (permalink / raw)
  To: sakari.ailus
  Cc: bingbu.cao, tian.shu.qiu, mchehab, gregkh, linux-media,
	linux-staging, linux-kernel, Brent Pappas

Replace the macro IPU3_ADDR2PTE() with a static function to match
Linux coding style standards.

Signed-off-by: Brent Pappas <bpappas@pappasbrent.com>
---
 drivers/staging/media/ipu3/ipu3-mmu.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/media/ipu3/ipu3-mmu.c b/drivers/staging/media/ipu3/ipu3-mmu.c
index cb9bf5fb29a5..d2d603c32773 100644
--- a/drivers/staging/media/ipu3/ipu3-mmu.c
+++ b/drivers/staging/media/ipu3/ipu3-mmu.c
@@ -25,7 +25,11 @@
 #define IPU3_PT_SIZE		(IPU3_PT_PTES << 2)
 #define IPU3_PT_ORDER		(IPU3_PT_SIZE >> PAGE_SHIFT)
 
-#define IPU3_ADDR2PTE(addr)	((addr) >> IPU3_PAGE_SHIFT)
+static u32 ipu3_addr2pte(phys_addr_t addr)
+{
+	return addr >> IPU3_PAGE_SHIFT;
+}
+
 #define IPU3_PTE2ADDR(pte)	((phys_addr_t)(pte) << IPU3_PAGE_SHIFT)
 
 #define IPU3_L2PT_SHIFT		IPU3_PT_BITS
@@ -200,7 +204,7 @@ static u32 *imgu_mmu_get_l2pt(struct imgu_mmu *mmu, u32 l1pt_idx)
 	l2pt = new_l2pt;
 	mmu->l2pts[l1pt_idx] = new_l2pt;
 
-	pteval = IPU3_ADDR2PTE(virt_to_phys(new_l2pt));
+	pteval = ipu3_addr2pte(virt_to_phys(new_l2pt));
 	mmu->l1pt[l1pt_idx] = pteval;
 
 	spin_unlock_irqrestore(&mmu->lock, flags);
@@ -230,7 +234,7 @@ static int __imgu_mmu_map(struct imgu_mmu *mmu, unsigned long iova,
 		return -EBUSY;
 	}
 
-	l2pt[l2pt_idx] = IPU3_ADDR2PTE(paddr);
+	l2pt[l2pt_idx] = ipu3_addr2pte(paddr);
 
 	spin_unlock_irqrestore(&mmu->lock, flags);
 
@@ -447,7 +451,7 @@ struct imgu_mmu_info *imgu_mmu_init(struct device *parent, void __iomem *base)
 	mmu->dummy_page = (void *)__get_free_page(GFP_KERNEL);
 	if (!mmu->dummy_page)
 		goto fail_group;
-	pteval = IPU3_ADDR2PTE(virt_to_phys(mmu->dummy_page));
+	pteval = ipu3_addr2pte(virt_to_phys(mmu->dummy_page));
 	mmu->dummy_page_pteval = pteval;
 
 	/*
@@ -457,7 +461,7 @@ struct imgu_mmu_info *imgu_mmu_init(struct device *parent, void __iomem *base)
 	mmu->dummy_l2pt = imgu_mmu_alloc_page_table(pteval);
 	if (!mmu->dummy_l2pt)
 		goto fail_dummy_page;
-	pteval = IPU3_ADDR2PTE(virt_to_phys(mmu->dummy_l2pt));
+	pteval = ipu3_addr2pte(virt_to_phys(mmu->dummy_l2pt));
 	mmu->dummy_l2pt_pteval = pteval;
 
 	/*
@@ -473,7 +477,7 @@ struct imgu_mmu_info *imgu_mmu_init(struct device *parent, void __iomem *base)
 	if (!mmu->l1pt)
 		goto fail_l2pts;
 
-	pteval = IPU3_ADDR2PTE(virt_to_phys(mmu->l1pt));
+	pteval = ipu3_addr2pte(virt_to_phys(mmu->l1pt));
 	writel(pteval, mmu->base + REG_L1_PHYS);
 	imgu_mmu_tlb_invalidate(mmu);
 	imgu_mmu_set_halt(mmu, false);
@@ -529,7 +533,7 @@ void imgu_mmu_resume(struct imgu_mmu_info *info)
 
 	imgu_mmu_set_halt(mmu, true);
 
-	pteval = IPU3_ADDR2PTE(virt_to_phys(mmu->l1pt));
+	pteval = ipu3_addr2pte(virt_to_phys(mmu->l1pt));
 	writel(pteval, mmu->base + REG_L1_PHYS);
 
 	imgu_mmu_tlb_invalidate(mmu);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-25 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-24 13:55 [PATCH] mdeia: ipu3: ipu33-mmu: Replace macro IPU3_ADDR2PTE() with a function Brent Pappas
2023-01-24 14:42 ` Dan Carpenter
2023-01-25 14:36   ` Brent Pappas
2023-01-25 15:27     ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox