Searched hist:f48ccb26e264b112afc087d562fa2d68e2e1174b (Results 1 – 1 of 1) sorted by relevance
/linux/drivers/hwmon/ |
H A D | lm95241.c | diff f48ccb26e264b112afc087d562fa2d68e2e1174b Mon Jul 04 06:46:05 CEST 2016 Guenter Roeck <linux@roeck-us.net> hwmon: (lm95241) Fix overflow problems, write conversion rate to chip
Writing the update_interval attribute could result in an overflow if a number close to the maximum unsigned long was written. At the same time, even though the chip supports setting the conversion rate, the selected conversion rate was not actually written to the chip.
Fix the second problem by selecting valid (supported) conversion rates, and writing the selected conversion rate to the chip. This also fixes the first problem, since arbitrary conversion rates are now converted to actually supported conversion rates.
Also, set the default chip conversion rate to 1 second. Previously, the chip was configured for continuous conversion, but readings were only retrieved every seond, which doesn't make much sense. If we only read a value from the chip every second, we can as well save some power and only convert in one-second intervals.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|