Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=941ed3b53086697eac7449f3ab5d2c5ab3259de2 Commit: 941ed3b53086697eac7449f3ab5d2c5ab3259de2 Parent: d384e35a25445bb60457b7dab8cffe178c6b7ecb Author: David Fries <[EMAIL PROTECTED]> AuthorDate: Tue Jan 22 03:31:37 2008 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Tue Jan 22 09:17:48 2008 -0800
W1: w1_therm.c ds18b20 decode freezing temperatures correctly Correct the decoding of negative C temperatures. The code did a binary OR of two bytes to make a 16 bit value, but assignd it to an integer. This caused the value to not be sign extended and to loose that it was a negative number in the assignment. Before the patch (in my freezer), w1_slave ed fe 4b 46 7f ff 03 10 e4 : crc=e4 YES ed fe 4b 46 7f ff 03 10 e4 t=4078 With the patch, e3 fe 4b 46 7f ff 0d 10 81 : crc=81 YES e3 fe 4b 46 7f ff 0d 10 81 t=-17 Signed-off-by: David Fries <[EMAIL PROTECTED]> Acked-by: Evgeniy Polyakov <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/w1/slaves/w1_therm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index 4318935..feed89e 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c @@ -112,7 +112,7 @@ static struct w1_therm_family_converter w1_therm_families[] = { static inline int w1_DS18B20_convert_temp(u8 rom[9]) { - int t = (rom[1] << 8) | rom[0]; + s16 t = (rom[1] << 8) | rom[0]; t /= 16; return t; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html