Message ID | 20220105232700.444170-3-dmitry.baryshkov@linaro.org |
---|---|
State | Accepted |
Commit | 3f4a80cbf968466c5ba0c78ef41cae8292965bd8 |
Headers | show |
Series | [v2,1/3] drm/msm: drop register logging support | expand |
Quoting Dmitry Baryshkov (2022-01-05 15:27:00) > With the reglog removal, msm_readl/_writel became single line wrappers > around readl/writel. Move those two wrappers and msm_rmw to msm_drv.h to > remove need for extra function calls when doing register writes. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > --- Reviewed-by: Stephen Boyd <swboyd@chromium.org> Any chance this can go further and replace msm_readl/msm_writel with readl/writel directly?
On Thu, 6 Jan 2022 at 02:43, Stephen Boyd <swboyd@chromium.org> wrote: > > Quoting Dmitry Baryshkov (2022-01-05 15:27:00) > > With the reglog removal, msm_readl/_writel became single line wrappers > > around readl/writel. Move those two wrappers and msm_rmw to msm_drv.h to > > remove need for extra function calls when doing register writes. > > > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > > --- > > Reviewed-by: Stephen Boyd <swboyd@chromium.org> > > Any chance this can go further and replace msm_readl/msm_writel with > readl/writel directly? This can go on a step-by-step basis. But practically yes. With this change in place we should be able to drop most of the io wrappers.
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 73757b7dc935..fd62a4da14a1 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -164,26 +164,6 @@ void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name, return _msm_ioremap(pdev, name, false, psize); } -void msm_writel(u32 data, void __iomem *addr) -{ - writel(data, addr); -} - -u32 msm_readl(const void __iomem *addr) -{ - u32 val = readl(addr); - - return val; -} - -void msm_rmw(void __iomem *addr, u32 mask, u32 or) -{ - u32 val = msm_readl(addr); - - val &= ~mask; - msm_writel(val | or, addr); -} - static enum hrtimer_restart msm_hrtimer_worktimer(struct hrtimer *t) { struct msm_hrtimer_work *work = container_of(t, diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 56d1242efcc1..3ab19775a5c3 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -484,9 +484,17 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name); void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name, phys_addr_t *size); void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name); -void msm_writel(u32 data, void __iomem *addr); -u32 msm_readl(const void __iomem *addr); -void msm_rmw(void __iomem *addr, u32 mask, u32 or); + +#define msm_writel(data, addr) writel((data), (addr)) +#define msm_readl(addr) readl((addr)) + +static inline void msm_rmw(void __iomem *addr, u32 mask, u32 or) +{ + u32 val = msm_readl(addr); + + val &= ~mask; + msm_writel(val | or, addr); +} /** * struct msm_hrtimer_work - a helper to combine an hrtimer with kthread_work
With the reglog removal, msm_readl/_writel became single line wrappers around readl/writel. Move those two wrappers and msm_rmw to msm_drv.h to remove need for extra function calls when doing register writes. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/gpu/drm/msm/msm_drv.c | 20 -------------------- drivers/gpu/drm/msm/msm_drv.h | 14 +++++++++++--- 2 files changed, 11 insertions(+), 23 deletions(-)