* [lm-sensors] [PATCH] hwmon: sht15: Off by one error in array index
@ 2009-12-10 19:10 Jonathan Cameron
2009-12-10 19:13 ` Jonathan Cameron
2009-12-10 19:48 ` [lm-sensors] [PATCH] hwmon: sht15: Off by one error in array Jean Delvare
0 siblings, 2 replies; 3+ messages in thread
From: Jonathan Cameron @ 2009-12-10 19:10 UTC (permalink / raw)
To: lm-sensors
Signed-off-by: Christoph Walser <walser@tik.eee.ethz.ch>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
Christoph noticed some problems with the sht15 driver and was kind enough
to send me a patch. If no one has any issues with this, it should also go
in stable once it merges with mainline.
drivers/hwmon/sht15.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
index ebe38b6..864a371 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -305,7 +305,7 @@ static inline int sht15_calc_temp(struct sht15_data *data)
int d1 = 0;
int i;
- for (i = 1; i < ARRAY_SIZE(temppoints) - 1; i++)
+ for (i = 1; i < ARRAY_SIZE(temppoints); i++)
/* Find pointer to interpolate */
if (data->supply_uV > temppoints[i - 1].vdd) {
d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd)
@@ -332,12 +332,12 @@ static inline int sht15_calc_humid(struct sht15_data *data)
const int c1 = -4;
const int c2 = 40500; /* x 10 ^ -6 */
- const int c3 = 2800; /* x10 ^ -9 */
+ const int c3 = -2800; /* x10 ^ -9 */
RHlinear = c1*1000
+ c2 * data->val_humid/1000
+ (data->val_humid * data->val_humid * c3)/1000000;
- return (temp - 25000) * (10000 + 800 * data->val_humid)
+ return (temp - 25000) * (10000 + 80 * data->val_humid)
/ 1000000 + RHlinear;
}
--
1.6.4.4
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [lm-sensors] [PATCH] hwmon: sht15: Off by one error in array index
2009-12-10 19:10 [lm-sensors] [PATCH] hwmon: sht15: Off by one error in array index Jonathan Cameron
@ 2009-12-10 19:13 ` Jonathan Cameron
2009-12-10 19:48 ` [lm-sensors] [PATCH] hwmon: sht15: Off by one error in array Jean Delvare
1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2009-12-10 19:13 UTC (permalink / raw)
To: lm-sensors
Signed-off-by: Christoph Walser <walser@tik.ee.ethz.ch>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
Christoph noticed some problems with the sht15 driver and was kind enough
to send me a patch. If no one has any issues with this, it should also go
in stable once it merges with mainline.
Sorry all. Typo in Christoph's email adress in previous version.
drivers/hwmon/sht15.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
index ebe38b6..864a371 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -305,7 +305,7 @@ static inline int sht15_calc_temp(struct sht15_data *data)
int d1 = 0;
int i;
- for (i = 1; i < ARRAY_SIZE(temppoints) - 1; i++)
+ for (i = 1; i < ARRAY_SIZE(temppoints); i++)
/* Find pointer to interpolate */
if (data->supply_uV > temppoints[i - 1].vdd) {
d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd)
@@ -332,12 +332,12 @@ static inline int sht15_calc_humid(struct sht15_data *data)
const int c1 = -4;
const int c2 = 40500; /* x 10 ^ -6 */
- const int c3 = 2800; /* x10 ^ -9 */
+ const int c3 = -2800; /* x10 ^ -9 */
RHlinear = c1*1000
+ c2 * data->val_humid/1000
+ (data->val_humid * data->val_humid * c3)/1000000;
- return (temp - 25000) * (10000 + 800 * data->val_humid)
+ return (temp - 25000) * (10000 + 80 * data->val_humid)
/ 1000000 + RHlinear;
}
--
1.6.4.4
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: sht15: Off by one error in array
2009-12-10 19:10 [lm-sensors] [PATCH] hwmon: sht15: Off by one error in array index Jonathan Cameron
2009-12-10 19:13 ` Jonathan Cameron
@ 2009-12-10 19:48 ` Jean Delvare
1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2009-12-10 19:48 UTC (permalink / raw)
To: lm-sensors
On Thu, 10 Dec 2009 19:13:37 +0000, Jonathan Cameron wrote:
>
> Signed-off-by: Christoph Walser <walser@tik.ee.ethz.ch>
> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
>
> Christoph noticed some problems with the sht15 driver and was kind enough
> to send me a patch. If no one has any issues with this, it should also go
> in stable once it merges with mainline.
>
> Sorry all. Typo in Christoph's email adress in previous version.
>
> drivers/hwmon/sht15.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
> index ebe38b6..864a371 100644
> --- a/drivers/hwmon/sht15.c
> +++ b/drivers/hwmon/sht15.c
> @@ -305,7 +305,7 @@ static inline int sht15_calc_temp(struct sht15_data *data)
> int d1 = 0;
> int i;
>
> - for (i = 1; i < ARRAY_SIZE(temppoints) - 1; i++)
> + for (i = 1; i < ARRAY_SIZE(temppoints); i++)
> /* Find pointer to interpolate */
> if (data->supply_uV > temppoints[i - 1].vdd) {
> d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd)
> @@ -332,12 +332,12 @@ static inline int sht15_calc_humid(struct sht15_data *data)
>
> const int c1 = -4;
> const int c2 = 40500; /* x 10 ^ -6 */
> - const int c3 = 2800; /* x10 ^ -9 */
> + const int c3 = -2800; /* x10 ^ -9 */
>
> RHlinear = c1*1000
> + c2 * data->val_humid/1000
> + (data->val_humid * data->val_humid * c3)/1000000;
> - return (temp - 25000) * (10000 + 800 * data->val_humid)
> + return (temp - 25000) * (10000 + 80 * data->val_humid)
> / 1000000 + RHlinear;
> }
>
Applied, thanks.
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-12-10 19:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10 19:10 [lm-sensors] [PATCH] hwmon: sht15: Off by one error in array index Jonathan Cameron
2009-12-10 19:13 ` Jonathan Cameron
2009-12-10 19:48 ` [lm-sensors] [PATCH] hwmon: sht15: Off by one error in array Jean Delvare
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.