[PATCH] mdeia: ipu3: ipu33-mmu: Replace macro IPU3_ADDR2PTE() with a function

From: Brent Pappas
Date: Tue Jan 24 2023 - 08:58:10 EST


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

Signed-off-by: Brent Pappas <bpappas@xxxxxxxxxxxxxxx>
---
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