Re: Locking in the clk API

From: Jeremy Kerr
Date: Tue Jan 11 2011 - 09:36:05 EST


Hi Paul,

> Again, you are approaching it from the angle that an atomic clock is a
> special requirement rather than the default behaviour.

I'm not considering it a special requirement, but it's still a requirement
(that the called function does not sleep).

The problem with the inverse logic (clk_enable/clk_enable_sleepable) is that
now you've made the caller need to know what kind of clock it has, or might
have one day.

* For clk_enable/clk_enable_atomic, the decision is: is this call in an
atomic context?

* For clk_enable/clk_enable_sleepable, the decision is: might the clock code
have given us a sleeping clock?

Note that it's much easier to guarantee correctness for the first than it is
for the second.

Cheers,


Jeremy
--
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/