Re: [PATCH v3 7/9] mfd: intel-m10-bmc: Add PMCI driver

From: Xu Yilun
Date: Mon Dec 05 2022 - 11:40:25 EST


On 2022-12-05 at 11:51:15 +0200, Ilpo Järvinen wrote:
> On Sat, 3 Dec 2022, Xu Yilun wrote:
>
> > On 2022-12-02 at 12:08:39 +0200, Ilpo Järvinen wrote:
> > > + void __iomem *base,
> > > + struct regmap_config *cfg,
> > > + struct lock_class_key *lock_key,
> > > + const char *lock_name)
> > > +{
> > > + struct indirect_ctx *ctx;
> > > +
> > > + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
> > > + if (!ctx)
> > > + return NULL;
> > > +
> > > + ctx->base = base;
> > > + ctx->dev = dev;
> > > +
> > > + indirect_bus_clear_cmd(ctx);
> > > +
> > > + return __devm_regmap_init(dev, &indirect_bus, ctx, cfg, lock_key, lock_name);
> >
> > Sorry, I just can't remember why don't we just call devm_regmap_init() and
> > get rid of all lock stuff?
>
> At this point, we're already entered into __-domain though a
> __regmap_lockdep_wrapper(). If I call devm_regmap_init() here, the
> second call into the wrapper would create another key which doesn't seem
> right.

I mean could we not define new regmap_init_xxx & __regmap_init_xxx
APIs? Just call devm_regmap_init() when we have prepared the context,
devm_regmap_init() will take care of the lock stuff.

Thanks,
Yilun