aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1
diff options
context:
space:
mode:
authorDavid Fries <david@fries.net>2008-02-06 04:38:09 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:10 -0500
commit7129b126cc64f530d793bd56eb1709a06ec65a2d (patch)
tree0db9e0beb74c8bda5b6d787871ffb06402a4d3a3 /drivers/w1
parent35841f708070bd295a96f6c98e566f8b251c1b48 (diff)
W1: w1_therm.c standardize units to millidegrees C
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>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/slaves/w1_therm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 112f4ec59035..fb28acaeed6c 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -92,6 +92,7 @@ struct w1_therm_family_converter
92 int (*convert)(u8 rom[9]); 92 int (*convert)(u8 rom[9]);
93}; 93};
94 94
95/* The return value is millidegrees Centigrade. */
95static inline int w1_DS18B20_convert_temp(u8 rom[9]); 96static inline int w1_DS18B20_convert_temp(u8 rom[9]);
96static inline int w1_DS18S20_convert_temp(u8 rom[9]); 97static inline int w1_DS18S20_convert_temp(u8 rom[9]);
97 98
@@ -113,7 +114,7 @@ static struct w1_therm_family_converter w1_therm_families[] = {
113static inline int w1_DS18B20_convert_temp(u8 rom[9]) 114static inline int w1_DS18B20_convert_temp(u8 rom[9])
114{ 115{
115 s16 t = (rom[1] << 8) | rom[0]; 116 s16 t = (rom[1] << 8) | rom[0];
116 t /= 16; 117 t = t*1000/16;
117 return t; 118 return t;
118} 119}
119 120