[alsa-devel] [PATCH 2/2] ASoC: fsi: add master clock control functions

Mark Brown broonie at opensource.wolfsonmicro.com
Mon Nov 5 09:03:37 CET 2012


On Sun, Nov 04, 2012 at 05:05:34PM -0800, Kuninori Morimoto wrote:

> > > +	own = clk_get(dev, NULL);
> > > +	if (IS_ERR(own))
> > > +		return -EINVAL;

> > Any reason not to use devm_clk_get()?
> 
> Ahh yes, Sorry.
> BTW, currect code calls this function many times now,
> (this clk is local variable now)
> then should I use...

>  1) use devm_clk_get() / devm_clk_put() pair
>  2) use clk_get() / clk_put() pair
>  3) keep these clocks under private date (struct fsi_prive)
>     and use devm_clk_get() only _probe timing.

Option 3 is the normal approach here.

> > > +	if (enable) {
> > > +		clk_disable(ick);

> > Are we sure that calls to this function are always balanced so that
> > calls to clk_enable() and clk_disable() are balanced?

> I balanced it by local technic.
> But I can say it is un-understandable.
> Can I use counter ?

Well, the whole thing is that the clk_enable() will count too so if you
don't make sure the calls are balanced you'll run into issues.  I'd add
some comments which explain why this is safe.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20121105/7f1dab0f/attachment-0001.sig>


More information about the Alsa-devel mailing list