Messages in this thread |  | | | Date | Sun, 13 Jun 2010 23:25:12 +0100 | | From | Ben Dooks <> | | Subject | Re: [RFC,PATCH 1/2] Add a common struct clk |
| |
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@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
|  |