Re: [RFC,PATCH 1/2] Add a common struct clk
From: Ben Dooks
Date: Sun Jun 13 2010 - 18:25:38 EST
On Fri, Jun 11, 2010 at 10:14:35AM +0200, Lothar Wa?mann wrote:
> Hi,
>
> > > > +static inline int clk_enable(struct clk *clk)
> > > > +{
> > > > + int ret = 0;
> > > > +
> > > > + if (!clk->ops->enable)
> > > > + return 0;
> > > > +
> > > > + mutex_lock(&clk->mutex);
> > > > + if (!clk->enable_count)
> > > > + ret = clk->ops->enable(clk);
> > > > +
> > > > + if (!ret)
> > > > + clk->enable_count++;
> > > > + mutex_unlock(&clk->mutex);
> > > > +
> > > > + return ret;
> > > > +}
> > >
> Using a mutex in clk_enable()/clk_disable() is a bad idea, since that
> makes it impossible to call those functions in interrupt context.
I think that is a bad idea, unless you can provide otherwise. These
calls can sleep depending on implementation, and thus I would like to
ensure that they are marked as might-sleep.
Is there any specific reason? If so, we need to add some form of ops
where we have _nosleep specificially for this case.
--
Ben (ben@xxxxxxxxx, http://www.fluff.org/)
'a smiley only costs 4 bytes'
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/