From: Jean Delvare <jdelvare@suse.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH 03/17] hwmon: (lm93) Fix overflows seen when writing into limit attributes
Date: Tue, 13 Dec 2016 15:01:00 +0100 [thread overview]
Message-ID: <20161213150100.4248a8e2@endymion> (raw)
In-Reply-To: <1480913740-5678-3-git-send-email-linux@roeck-us.net>
Hi Guetner,
I kept the more tasty one for last ;-)
On Sun, 4 Dec 2016 20:55:26 -0800, Guenter Roeck wrote:
> Module test shows a large number of overflows, caused by missing clamps
> as well as various conversions between variable types.
>
> Also fix temperature calculations for hysteresis and offset registers.
> For those, temperature calculations were a mix of millisecond and second
> based, causing reported and accepted hysteresis and offset temperatures
> to be widely off target.
>
> This also changes the offset and base temperature attributes to be
> officially reported and set in milli-degrees C. This was already the case
> for the base temperature attribute, even though it was documented to be
> reported and set in degrees C.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Documentation/hwmon/lm93 | 26 ++++++++++++-------------
> drivers/hwmon/lm93.c | 49 +++++++++++++++++++++++++-----------------------
> 2 files changed, 39 insertions(+), 36 deletions(-)
>
> diff --git a/Documentation/hwmon/lm93 b/Documentation/hwmon/lm93
> index f3b2ad2ceb01..7bda7f0291e4 100644
> --- a/Documentation/hwmon/lm93
> +++ b/Documentation/hwmon/lm93
> @@ -174,25 +174,25 @@ a "0" disables it. The h/w default is 0x0f (all temperatures bound).
>
> The function y = f(x) takes a source temperature x to a PWM output y. This
> function of the LM93 is derived from a base temperature and a table of 12
> -temperature offsets. The base temperature is expressed in degrees C in the
> -sysfs files temp<n>_auto_base. The offsets are expressed in cumulative
> -degrees C, with the value of offset <i> for temperature value <n> being
> +temperature offsets. The base temperature is expressed in milli-degrees C in
> +the sysfs files temp<n>_auto_base. The offsets are expressed in cumulative
> +milli-degrees C, with the value of offset <i> for temperature value <n> being
> contained in the file temp<n>_auto_offset<i>. E.g. if the base temperature
> is 40C:
>
> offset # temp<n>_auto_offset<i> range pwm
> 1 0 - 25.00%
> 2 0 - 28.57%
> - 3 1 40C - 41C 32.14%
> - 4 1 41C - 42C 35.71%
> - 5 2 42C - 44C 39.29%
> - 6 2 44C - 46C 42.86%
> - 7 2 48C - 50C 46.43%
> - 8 2 50C - 52C 50.00%
> - 9 2 52C - 54C 53.57%
> - 10 2 54C - 56C 57.14%
> - 11 2 56C - 58C 71.43%
> - 12 2 58C - 60C 85.71%
> + 3 500 40C - 41C 32.14%
> + 4 500 41C - 42C 35.71%
> + 5 1000 42C - 44C 39.29%
> + 6 1000 44C - 46C 42.86%
> + 7 1000 48C - 50C 46.43%
> + 8 1000 50C - 52C 50.00%
> + 9 1000 52C - 54C 53.57%
> + 10 1000 54C - 56C 57.14%
> + 11 1000 56C - 58C 71.43%
> + 12 1000 58C - 60C 85.71%
> > 60C 100.00%
I'm a bit confused, I would have expected 1000 and 2000 for
temp<n>_auto_offset<i>, not 500 and 1000? Otherwise I can't see how you
get the announced ranges.
>
> Valid offsets are in the range 0C <= x <= 7.5C in 0.5C increments.
> diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c
> index 90bb04858117..7b3152368e3b 100644
> --- a/drivers/hwmon/lm93.c
> +++ b/drivers/hwmon/lm93.c
> (...)
Code changes all look good to me, good job. Hairy code :-/
Reviewed-by: Jean Delvare <jdelvare@suse.de>
--
Jean Delvare
SUSE L3 Support
next prev parent reply other threads:[~2016-12-13 14:01 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-05 4:55 [PATCH 01/17] hwmon: (adm9240) Fix overflows seen when writing into limit attributes Guenter Roeck
2016-12-05 4:55 ` [PATCH 02/17] hwmon: (ds620) Fix overflows seen when writing temperature limits Guenter Roeck
2016-12-08 13:47 ` Jean Delvare
2016-12-05 4:55 ` [PATCH 03/17] hwmon: (lm93) Fix overflows seen when writing into limit attributes Guenter Roeck
2016-12-13 14:01 ` Jean Delvare [this message]
2016-12-13 14:52 ` Guenter Roeck
2016-12-05 4:55 ` [PATCH 04/17] hwmon: (smsc47m192) " Guenter Roeck
2016-12-08 13:57 ` Jean Delvare
2016-12-08 19:24 ` Guenter Roeck
2016-12-05 4:55 ` [PATCH 05/17] hwmon: (adm1025) Fix overflows seen when writing voltage limits Guenter Roeck
2016-12-08 14:04 ` Jean Delvare
2016-12-05 4:55 ` [PATCH 06/17] hwmon: (adm1026) Fix overflows seen when writing into limit attributes Guenter Roeck
2016-12-08 14:33 ` Jean Delvare
2016-12-08 15:34 ` Guenter Roeck
2016-12-09 9:29 ` Jean Delvare
2016-12-05 4:55 ` [PATCH 07/17] hwmon: (adt7462) " Guenter Roeck
2016-12-08 15:08 ` Jean Delvare
2016-12-05 4:55 ` [PATCH 08/17] hwmon: (adt7470) " Guenter Roeck
2016-12-08 15:14 ` Jean Delvare
2016-12-08 18:14 ` Guenter Roeck
2016-12-05 4:55 ` [PATCH 09/17] hwmon: (nct7802) " Guenter Roeck
2016-12-09 9:49 ` Jean Delvare
2016-12-09 14:22 ` Guenter Roeck
2016-12-09 15:25 ` Jean Delvare
2016-12-09 18:11 ` Guenter Roeck
2016-12-05 4:55 ` [PATCH 10/17] hwmon: (lm87) Fix overflow seen when writing voltage " Guenter Roeck
2016-12-09 15:07 ` Jean Delvare
2016-12-05 4:55 ` [PATCH 11/17] hwmon: (lm85) Fix overflows " Guenter Roeck
2016-12-09 16:07 ` Jean Delvare
2016-12-05 4:55 ` [PATCH 12/17] hwmon: (dme1737) Fix overflows seen when writing into " Guenter Roeck
2016-12-12 9:33 ` Jean Delvare
2016-12-12 14:21 ` Guenter Roeck
2016-12-05 4:55 ` [PATCH 13/17] hwmon: (emc2103) Fix overflows seen when temperature " Guenter Roeck
2016-12-12 10:44 ` Jean Delvare
2016-12-05 4:55 ` [PATCH 14/17] hwmon: (emcw201) Fix overflows seen when writing into " Guenter Roeck
2016-12-12 10:48 ` Jean Delvare
2016-12-12 14:23 ` Guenter Roeck
2016-12-05 4:55 ` [PATCH 15/17] hwmln: (g762) Fix overflows and crash seen when writing " Guenter Roeck
2016-12-12 11:14 ` Jean Delvare
2016-12-12 14:19 ` Guenter Roeck
2016-12-05 4:55 ` [PATCH 16/17] hwmon: (gl518sm) Fix overflows seen when writing into " Guenter Roeck
2016-12-13 9:48 ` Jean Delvare
2016-12-13 21:56 ` Guenter Roeck
2016-12-05 4:55 ` [PATCH 17/17] hwmon: (gl520sm) " Guenter Roeck
2016-12-13 9:56 ` Jean Delvare
2016-12-13 14:49 ` Guenter Roeck
2016-12-08 13:29 ` [PATCH 01/17] hwmon: (adm9240) " Jean Delvare
2016-12-08 15:18 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161213150100.4248a8e2@endymion \
--to=jdelvare@suse.de \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.