Skip to content

Commit

Permalink
W1: w1_therm.c standardize units to millidegrees C
Browse files Browse the repository at this point in the history
Standardize the temperature units to millidegrees C for the two sensor
conversion routines.  Previously the routines were,

w1_DS18B20_convert_temp degrees C
w1_DS18S20_convert_temp millidegrees C

Unfortunately this will break any program using the ds18b20 value as it
will now be 1000 times bigger.  Fortunately there can't be that many users
out there, or some of these bugs will have been fixed by now, such as the
negative C error (see previous patch) that makes me think the ds18b20 is
the better choice to change because of the current bugs.

Signed-off-by: David Fries <david@fries.net>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Fries authored and Linus Torvalds committed Feb 6, 2008
1 parent 35841f7 commit 7129b12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/w1/slaves/w1_therm.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ struct w1_therm_family_converter
int (*convert)(u8 rom[9]);
};

/* The return value is millidegrees Centigrade. */
static inline int w1_DS18B20_convert_temp(u8 rom[9]);
static inline int w1_DS18S20_convert_temp(u8 rom[9]);

Expand All @@ -113,7 +114,7 @@ static struct w1_therm_family_converter w1_therm_families[] = {
static inline int w1_DS18B20_convert_temp(u8 rom[9])
{
s16 t = (rom[1] << 8) | rom[0];
t /= 16;
t = t*1000/16;
return t;
}

Expand Down

0 comments on commit 7129b12

Please sign in to comment.