[U-Boot] [PATCH v2] Move ICS CLK chip frequenty calculation code into a common board library

Kumar Gala
2010-05-24T18:57:12Z

On May 24, 2010, at 9:52 AM, Timur Tabi wrote:

> On Sat, May 22, 2010 at 5:36 PM, Kumar Gala <galak@kernel.crashing.org> wrote:
>
>> +static unsigned long
>> +ics307_clk_freq(unsigned char cw0, unsigned char cw1, unsigned char cw2)
>
> You forgot to change these to u8

Oops, thought that was fixed.

> Also, you can declare this function as "const". You could just use
> the version of this function that I posted, you just need to remove my
> rounding code.

What in the world does 'const' get me in C.

>> + * Adding 1 to get a "nicely" rounded number, but this needs
>> + * more tweaking to get a "properly" rounded number.
>> + */
>> +
>> + freq = 1 + (input_freq * 2 * (vdw + 8) / ((rdw + 2) * od));
>
> The "1 +" is wrong and should be removed. It doesn't do what the
> comment says it does, and as you said earlier, rounding is wrong for
> this function.

Dropped the 1+

- k