[lm-sensors] hwmon/w83627hf pwm_freq support

Dmitry Bely dmitry.bely at gmail.com
Mon May 28 14:54:32 CEST 2007


On 5/28/07, Carlos Olalla Martínez <com.ea at tinet.org> wrote:
> > > +   u8 i;
> > > +   /* Only 5 dividers (1 2 4 8 16)... Search for the nearest available
> frequency */
> > > +   for (i = 0; i < 5; i++) {
> > > +           if (val > (((W83627HF_BASE_PWM_FREQ >> i) + (W83627HF_BASE_PWM_FREQ
> >> (i+1))) / 2))
> > > +                   break;
> > > +   }
> > > +   return i;
> > > +}
>
> > This could return with i = 5, which isn't correct.
>
> Hi Jean,
>
> I dont agree on your statement; I think
>
> for (i = 0; i < 5; i++)
>
> is the same as
>
> for (i = 0; i <= 4; i++)
>
> so maximum i returned is 4. Am I wrong?

Of course, wrong:

for (i = 0; i < 5; i++){
}
// i == 5 here

- Dmitry Bely



More information about the lm-sensors mailing list