[PATCH v19 06/25] soc: mediatek: add mtk_mmsys_write_reg API
Nancy.Lin
nancy.lin at mediatek.com
Wed May 4 01:36:18 UTC 2022
Hi Angelo,
Thanks for the review.
On Tue, 2022-05-03 at 14:19 +0200, AngeloGioacchino Del Regno wrote:
> Il 03/05/22 12:23, Nancy.Lin ha scritto:
> > Add mtk_mmsys_write_reg API. Simplify code for writing mmsys reg.
> > It is a preparation for adding support for mmsys config API.
> >
> > Signed-off-by: Nancy.Lin <nancy.lin at mediatek.com>
> > ---
> > drivers/soc/mediatek/mtk-mmsys.c | 35 ++++++++++++++-------------
> > -----
> > 1 file changed, 15 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/soc/mediatek/mtk-mmsys.c
> > b/drivers/soc/mediatek/mtk-mmsys.c
> > index ab3c5cbb0175..3e2e5e3f721d 100644
> > --- a/drivers/soc/mediatek/mtk-mmsys.c
> > +++ b/drivers/soc/mediatek/mtk-mmsys.c
> > @@ -191,22 +191,26 @@ static int
> > mtk_mmsys_find_match_drvdata(struct mtk_mmsys *mmsys,
> > return -EINVAL;
> > }
> >
> > +static void mtk_mmsys_write_reg(struct mtk_mmsys *mmsys, u32
> > offset, u32 mask, u32 val)
> > +{
> > + u32 tmp;
> > +
> > + tmp = readl_relaxed(mmsys->regs + offset);
> > + tmp = (tmp & ~mask) | val;
> > + writel_relaxed(tmp, mmsys->regs + offset);
> > +}
> > +
>
> Uhm... this is the equivalent of regmap_update_bits(): I fear that
> calling this
> mtk_mmsys_write_reg() may lead to confusion.
>
> I think that a more appropriate name would be mtk_mmsys_update_bits()
> or
> something similar, recalling that this is not just a register write,
> but
> a RMW.
>
> Regards,
> Angelo
Thanks for your suggestion. I will refine the function name in the next
revision.
Regards,
Nancy
More information about the dri-devel
mailing list