login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
April
»
1
Re: [lm-sensors] [PATCH] hwmon: sht15: Fix sht15_calc_temp interpolation function
view
thread
Previous message: [thread] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Jerome Oufella
Subject:
Re: [lm-sensors] [PATCH] hwmon: sht15: Fix sht15_calc_temp interpolation function
Date: Thursday, April 1, 2010 - 5:54 am
----- "Jean Delvare" <khali@linux-fr.org> wrote :
quoted text
> May I suggest the more simple fix below? > > --- > drivers/hwmon/sht15.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > --- linux-2.6.34-rc3.orig/drivers/hwmon/sht15.c 2010-04-01 > 13:41:15.000000000 +0200 > +++ linux-2.6.34-rc3/drivers/hwmon/sht15.c 2010-04-01 > 13:41:55.000000000 +0200 > @@ -305,10 +305,10 @@ static inline int sht15_calc_temp(struct > int d1 = 0; > int i; > > - for (i = 1; i < ARRAY_SIZE(temppoints); i++) > + for (i = ARRAY_SIZE(temppoints) - 1; i > 0 ;i--) > /* Find pointer to interpolate */ > if (data->supply_uV > temppoints[i - 1].vdd) { > - d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd) > + d1 = (data->supply_uV - temppoints[i - 1].vdd) > * (temppoints[i].d1 - temppoints[i - 1].d1) > / (temppoints[i].vdd - temppoints[i - 1].vdd) > + temppoints[i - 1].d1; > > It leads to the same numbers as with Jerome's patch, with the > advantages that 1* it is a much smaller change, more suitable for > applying to stable kernels and 2* it avoids the magic constant number > 10000. > > The "/1000" seems to be a relict of former times when > temppoints[*].vdd > was probably expressed in millivolt instead of microvolt. And the > inverted loop iteration is obviously a bug. > > Note that in both cases, something should be done about values which > are outside of the temppoints array. I don't know how likely these > are, > but they are seriously mishandled. For supply_uV values below > temppoints[0].vdd, d1 defaults to 0, so no adjustment is done at all. > temppoints[0].d1 would seem to be a much better default, if we don't > want to do any interpolation in that case. For supply_uV values above > temppoints[4].vdd, we do interpolate, which seems reasonable. > > Opinions? > > -- > Jean Delvare
That's fine, it does a good job for me, in the expected voltage range. Jerome Oufella --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [thread] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
Re: [lm-sensors] [PATCH] hwmon: sht15: Fix sht15_calc_temp ...
, Jerome Oufella
, (Thu Apr 1, 5:54 am)
Re: [lm-sensors] [PATCH] hwmon: sht15: Fix sht15_calc_temp ...
, Jonathan Cameron
, (Thu Apr 1, 6:49 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Jakub Narebski
Re: [PATCH] gitweb: Fix shortlog only showing HEAD revision.
Rafael J. Wysocki
[Bug #16136] Linux 2.6.34 causes system lockup on Compaq Presario 2200 Laptop
Paul E. McKenney
Re: [PATCH, RFC] v4 scalable classic RCU implementation
Greg Kroah-Hartman
[PATCH 20/36] Driver core: Call device_pm_add() after bus_add_device() in device_a...
Jeremy Fitzhardinge
Re: [patch 1/6] Re-enable VDSO by default with PARAVIRT
git
:
Christian Stimming
git-gui: Fix broken revert confirmation.
Stephen R. van den Berg
Re: [RFC] origin link for cherry-pick and revert
Junio C Hamano
Re: git-svnimport
Mark Burton
Re: [PATCH] builtin-branch: highlight current remote branches with an asterisk
Johannes Schindelin
Re: [PATCH] Fix approxidate("never") to always return 0
git-commits-head
:
Linux Kernel Mailing List
ath9k_htc: Allocate URBs properly
Linux Kernel Mailing List
cpumask: make irq_set_affinity() take a const struct cpumask
Linux Kernel Mailing List
V4L/DVB (9041): Add support YUAN High-Tech STK7700D (1164:1f08)
Linux Kernel Mailing List
ARM: 5670/1: bcmring: add default configuration for bcmring arch
Linux Kernel Mailing List
ahci: Workaround HW bug for SB600/700 SATA controller PMP support
linux-netdev
:
Nick Piggin
Re: Kernel WARNING: at net/core/dev.c:1330 __netif_schedule+0x2c/0x98()
Daniel Lezcano
getsockopt(TCP_DEFER_ACCEPT) value change
David Miller
Re: 2.6.27.18: bnx2/tg3: BUG: "scheduling while atomic" trying to ifenslave a seco...
Amit Kumar Salecha
[PATCH NEXT 10/10] qlcnic: add cksum flag
Patrick McHardy
Re: [PATCH RESEND 1/3] netfilter: xtables: inclusion of xt_condition
openbsd-misc
:
James Hozier
Re: DVD burn error: No space left on device
Christophe Rioux
Implementation example of snmp
Ryan McBride
Re: Packets Per Second Limit?
Nick Holland
Re: booting openbsd on eee without cd-rom
Very Fashion.com
Very-fashion.com -Novo! Brendirana garderoba po najpovoljnijim cenama.Bisou Bisou ...
Colocation donated by:
Syndicate