]>
Commit | Line | Data |
---|---|---|
80e6ae8f GKH |
1 | From 4235f684b66d6f00d2cd8849c884cf8f8b57ecad Mon Sep 17 00:00:00 2001 |
2 | From: Jonathan Cameron <jic23@cam.ac.uk> | |
3 | Date: Wed, 16 Dec 2009 21:38:28 +0100 | |
4 | Subject: hwmon: (sht15) Off-by-one error in array index + incorrect constants | |
5 | ||
6 | From: Jonathan Cameron <jic23@cam.ac.uk> | |
7 | ||
8 | commit 4235f684b66d6f00d2cd8849c884cf8f8b57ecad upstream. | |
9 | ||
10 | Fix an off-by-one error in array index + incorrect constants. | |
11 | ||
12 | Signed-off-by: Christoph Walser <walser@tik.ee.ethz.ch> | |
13 | Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> | |
14 | Signed-off-by: Jean Delvare <khali@linux-fr.org> | |
15 | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> | |
16 | ||
17 | --- | |
18 | drivers/hwmon/sht15.c | 6 +++--- | |
19 | 1 file changed, 3 insertions(+), 3 deletions(-) | |
20 | ||
21 | --- a/drivers/hwmon/sht15.c | |
22 | +++ b/drivers/hwmon/sht15.c | |
23 | @@ -305,7 +305,7 @@ static inline int sht15_calc_temp(struct | |
24 | int d1 = 0; | |
25 | int i; | |
26 | ||
27 | - for (i = 1; i < ARRAY_SIZE(temppoints) - 1; i++) | |
28 | + for (i = 1; i < ARRAY_SIZE(temppoints); i++) | |
29 | /* Find pointer to interpolate */ | |
30 | if (data->supply_uV > temppoints[i - 1].vdd) { | |
31 | d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd) | |
32 | @@ -332,12 +332,12 @@ static inline int sht15_calc_humid(struc | |
33 | ||
34 | const int c1 = -4; | |
35 | const int c2 = 40500; /* x 10 ^ -6 */ | |
36 | - const int c3 = 2800; /* x10 ^ -9 */ | |
37 | + const int c3 = -2800; /* x10 ^ -9 */ | |
38 | ||
39 | RHlinear = c1*1000 | |
40 | + c2 * data->val_humid/1000 | |
41 | + (data->val_humid * data->val_humid * c3)/1000000; | |
42 | - return (temp - 25000) * (10000 + 800 * data->val_humid) | |
43 | + return (temp - 25000) * (10000 + 80 * data->val_humid) | |
44 | / 1000000 + RHlinear; | |
45 | } | |
46 |