On Thu, Jun 27, 2013 at 10:36:31AM +0200, Jean Delvare wrote: > I'm once again late, but I could not find the time to test your ds1621 > patches before today. > > On Wed, 8 May 2013 22:45:53 -0700, Robert Coulson wrote: > > --- a/drivers/hwmon/ds1621.c > > +++ b/drivers/hwmon/ds1621.c > > (...) > > +/* > > + * TEMP: 0.001C/bit (-55C to +125C) > > + * REG: > > + * - 1621, 1625: x = 0.5C > > + * - 1721: x = 0.0625C > > + * Assume highest resolution and let the bits fall where they may.. > > + */ > > +static inline u16 DS1621_TEMP_TO_REG(long temp) > > +{ > > + int ntemp = clamp_val(temp, DS1621_TEMP_MIN, DS1621_TEMP_MAX); > > + ntemp += (ntemp < 0 ? -31 : 31); > > + ntemp = DIV_ROUND_CLOSEST(ntemp * 10, 625) << 4; > > + return (u16)ntemp; > > +} > > This breaks limit rounding on the DS1621. Limits have a resolution of > 0.5°C on that chip, so limit values should rounded to the closest > half-degree. It used to work but no longer: if I write 20300 to > temp1_min, it is rounded down to 20000, while it should be rounded up > to 20500. > My fault, since I proposed that approach. Didn't I have the same problem with some other driver ? Makes it even worse. I'll have to look up my notes. Guenter _______________________________________________ lm-sensors mailing list lm-sensors@xxxxxxxxxxxxxx http://lists.lm-sensors.org/mailman/listinfo/lm-sensors