Axel Lin 5b96308916 hwmon: (lm92) Prevent overflow problem when writing large limits
On platforms with sizeof(int) < sizeof(long), writing a temperature
limit larger than MAXINT will result in unpredictable limit values
written to the chip. Avoid auto-conversion from long to int to fix
the problem.

The hysteresis temperature range depends on the value of
data->temp[attr->index], since val is subtracted from it.
Use a wider clamp, [-120000, 220000] should do to cover the
possible range. Also add missing TEMP_TO_REG() on writes into
cached hysteresis value.

Also uses clamp_val to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
[Guenter Roeck: Fixed double TEMP_TO_REG on hysteresis updates]
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-08-05 17:48:52 -07:00
..
2014-08-05 16:19:15 -07:00
2014-07-23 17:42:37 -07:00
2014-08-04 18:34:04 -07:00
2014-08-04 18:36:12 -07:00
2014-08-04 12:31:53 -07:00
2014-07-25 18:00:23 -07:00
2014-07-15 20:55:15 +02:00
2014-07-30 00:23:09 +02:00
2014-06-17 15:43:48 -07:00
2014-06-11 14:06:55 -07:00
2014-06-06 11:44:09 -07:00
2014-08-05 16:18:13 -07:00
2014-06-26 10:48:23 +01:00
2014-07-13 13:16:50 -07:00
2014-07-13 15:26:47 -07:00
2014-08-04 20:11:28 -07:00
2014-06-23 09:22:48 +03:00
2014-06-23 12:38:08 -04:00
2014-07-11 10:38:02 +02:00
2014-08-04 18:34:04 -07:00