Re: [PATCH] clk: divider: fix rate calculation for fractional rates

From: Tomi Valkeinen
Date: Tue Jan 28 2014 - 05:41:26 EST


On 2014-01-28 12:32, Russell King - ARM Linux wrote:

>> Why I'm asking this is that for me (and probably for others also if
>> you've seen it used in the kernel code) it feels natural to have code like:
>>
>> rate = clk_round_rate(clk, rate);
>>
>> /* Verify the rounded rate here to see it's ok for the IP etc */
>>
>> /* The rate is ok, so set it */
>> clk_set_rate(clk, rate);
>
> If you want to do something with the rounded rate, then that's fine,
> you have a reason to do it this way. However, what I was referring to
> are drivers which literally do this:
>
> clk_set_rate(clk, clk_round_rate(clk, rate));

Thanks for clarification. Agreed, that's pointless. I gave the sequence
in the patch description just as an example for the sake of discussion
about the bug.

I didn't realize people actually do that in real code =).

Tomi


Attachment: signature.asc
Description: OpenPGP digital signature