[PATCH 1/2] clk: Add a devm variant of clk_rate_exclusive_get()

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Thu Jan 4 10:06:29 PST 2024


Hello Stephen,

On Mon, Dec 18, 2023 at 02:01:41PM +0100, Uwe Kleine-König wrote:
> [Cc += Maxime]
> 
> Hello Stephen,
> 
> On Sun, Dec 17, 2023 at 04:17:41PM -0800, Stephen Boyd wrote:
> > Quoting Uwe Kleine-König (2023-12-12 10:09:42)
> > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > > index af2011c2a93b..78249ca2341c 100644
> > > --- a/drivers/clk/clk.c
> > > +++ b/drivers/clk/clk.c
> > > @@ -937,6 +937,21 @@ void clk_rate_exclusive_get(struct clk *clk)
> > >  }
> > >  EXPORT_SYMBOL_GPL(clk_rate_exclusive_get);
> > >  
> > > +static void devm_clk_rate_exclusive_put(void *data)
> > > +{
> > > +       struct clk *clk = data;
> > > +
> > > +       clk_rate_exclusive_put(clk);
> > > +}
> > > +
> > > +int devm_clk_rate_exclusive_get(struct device *dev, struct clk *clk)
> > > +{
> > > +       clk_rate_exclusive_get(clk);
> > 
> > It seems the other thread wants this to return an error value.
> 
> The status quo is that clk_rate_exclusive_get() always returns zero.
> Some users do error handling (which is dead code until Maxime reworks
> the call that it might return something non-zero), others just call it
> without checking.
> 
> If you don't require to add something like:
> 
> 	ret = clk_rate_exclusive_get(clk);
> 	if (ret)
> 		return ret;
> 
> where we currently have just
> 
> 	clk_rate_exclusive_get(clk);
> 
> the patch can just be applied (using git am -3) not even hitting a merge
> conflict without that other series.

I wonder what you think about this. This devm_clk_rate_exclusive_get()
would be very useful and simplify a few more drivers.

Do you intend to take the patch as is, or should I rework it to check
for the zero it returns?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20240104/e97c50b9/attachment.sig>


More information about the linux-arm-kernel mailing list