[lkml]   [2011]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Locking in the clk API
Hi Russell,

> I object to this as one of the purposes behind the clk API is to allow
> power savings to be made, and unless we can perform clk enable/disable
> from atomic contexts, the best you can do is enable the clock when the
> device is probed and disable it when it's released.
> [...]
> Sometimes the only point that you know you need the clock enabled is when
> your driver has already been called in an atomic context.

.. provided that the enable (and subsequent things that depend on the clock
signal to be valid) can't be deferred; I'm not sure how often this will be

So, it sounds like the best approach is to provide an atomic clk_enable. I
agree with Sascha that the clk_enable and clk_enable_atomic polarity makes the
most sense, so how about:

int clk_enable(struct clk *clk)


int clk_enable_atomic(struct clk *clk)
BUG_ON(!(clk->flags & CLK_ATOMIC));


Paul: even though you mention that the atomic clocks are the usual case, I
think that this way around illustrates the atomic 'restriction' at the call
site more clearly. When the drivers don't care about the atomicity,
clk_enable() is fine. When drivers do need an atomic clock,
clk_enable_atomic() shows this requirement.



 \ /
  Last update: 2011-01-11 10:47    [W:0.180 / U:6.616 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site