On Wed, 2015-10-14 at 09:48 +0100, Sudeep Holla wrote:
OK, I understand what you mean now. I don't have a strong opinion, but
here is the reason why I prefer the approach I said earlier:
clk_set_rate doesn't return error if the h/w or f/w return error which
is usually the last step. So calling clk_get_rate when clk_set_rate
return error quite early makes no sense to me.
It doesn't to me either, but my suggested code doesn't do that, it only
calls clk_get_rate if the is _no_ error from clk_set_rate, the pseudo
code again...
ret = clk_set_rate()
if(!ret) /* if no error from clk_set_rate */
if(clk_get_rate()!=correct) /* but some additional checks fail */
ret = -EIO; /* then indicate an error anyway */
!ret is ret==0 is 'no error' as the comment says. So the clock framework
thinks the rate was set OK and we then use clk_get_rate to see if those
unreported h/w or f/w errors mean that it actually wasn't set OK.