[PATCH v5 1/2] clk: Provide managed helper to get and enable bulk clocks

Manivannan Sadhasivam manivannan.sadhasivam at linaro.org
Fri Feb 16 03:33:47 PST 2024


On Fri, Feb 16, 2024 at 05:01:47PM +0530, Manivannan Sadhasivam wrote:
> On Tue, Feb 13, 2024 at 06:57:50PM +0530, Shradha Todi wrote:
> > Provide a managed devm_clk_bulk* wrapper to get and enable all
> > bulk clocks in order to simplify drivers that keeps all clocks
> > enabled for the time of driver operation.
> > 
> > Suggested-by: Marek Szyprowski <m.szyprowski at samsung.com>
> > Reviewed-by: Alim Akhtar <alim.akhtar at samsung.com>
> > Signed-off-by: Shradha Todi <shradha.t at samsung.com>
> 
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>
> 
> - Mani
> 
> > ---
> >  drivers/clk/clk-devres.c | 40 ++++++++++++++++++++++++++++++++++++++++
> >  include/linux/clk.h      | 23 +++++++++++++++++++++++
> >  2 files changed, 63 insertions(+)
> > 

[...]

> > diff --git a/include/linux/clk.h b/include/linux/clk.h
> > index 1ef013324237..85a9330d5a5a 100644
> > --- a/include/linux/clk.h
> > +++ b/include/linux/clk.h
> > @@ -438,6 +438,22 @@ int __must_check devm_clk_bulk_get_optional(struct device *dev, int num_clks,
> >  int __must_check devm_clk_bulk_get_all(struct device *dev,
> >  				       struct clk_bulk_data **clks);
> >  
> > +/**
> > + * devm_clk_bulk_get_all_enable - Get and enable all clocks of the consumer (managed)
> > + * @dev: device for clock "consumer"
> > + * @clks: pointer to the clk_bulk_data table of consumer
> > + *
> > + * Returns success (0) or negative errno.
> > + *
> > + * This helper function allows drivers to get all clocks of the
> > + * consumer and enables them in one operation with management.
> > + * The clks will automatically be disabled and freed when the device
> > + * is unbound.
> > + */
> > +
> > +int __must_check devm_clk_bulk_get_all_enable(struct device *dev,
> > +					      struct clk_bulk_data **clks);
> > +
> >  /**
> >   * devm_clk_get - lookup and obtain a managed reference to a clock producer.
> >   * @dev: device for clock "consumer"
> > @@ -960,6 +976,13 @@ static inline int __must_check devm_clk_bulk_get_all(struct device *dev,
> >  	return 0;
> >  }
> >  
> > +static inline int __must_check devm_clk_bulk_get_all_enable(struct device *dev,
> > +						struct clk_bulk_data **clks)
> > +{
> > +

Just noticed this extra newline after sending my r-b tag. Please remove it in
next iteration.

- Mani

-- 
மணிவண்ணன் சதாசிவம்



More information about the linux-arm-kernel mailing list