Re: [PATCH v1 1/5] regmap: mmio: Don't unprepare attached clock

From: Andy Shevchenko
Date: Mon Aug 08 2022 - 09:42:30 EST


On Mon, Aug 8, 2022 at 3:19 PM Mark Brown <broonie@xxxxxxxxxx> wrote:
>
> On Fri, Aug 05, 2022 at 11:53:17PM +0300, Andy Shevchenko wrote:
> > The commit eb4a219d19fd ("regmap: Skip clk_put for attached clocks when
> > freeing context") oexcluded clk_put() call on regmap freeing. But the
> > same is needed for clk_unprepare() since the regmap MMIO users should
> > call regmap_mmio_detach_clk() which does unprepare the clock. Update
> > the code accordingly, so neither clk_put() nor clk_unprepare() would
> > be called for the attached clock.
>
> regmap_mmio_attach_clk() prepares the clock that's passed in, we should
> undo that when detaching otherwise we're leaking a prepare (as we do in
> the explicit detach).

Why do we allow the user to avoid explicit detach? What is the point
of having that API in the case we take care of it?

--
With Best Regards,
Andy Shevchenko