summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/smsc47m192.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 15:43:56 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 15:43:56 -0800
commit1c59e1edb13d60b97b7b03b332ceed5d967d4227 (patch)
treed5340c2e7b3682adc190b939aec8666bc3659a56 /drivers/hwmon/smsc47m192.c
parentbb3dd056ed1af9b186f0d9fe849eab78c51d14ce (diff)
parent4fccd4a1e8944033bcd7693ea4e8fb478cd2059a (diff)
downloadlinux-stable-1c59e1edb13d60b97b7b03b332ceed5d967d4227.tar.gz
linux-stable-1c59e1edb13d60b97b7b03b332ceed5d967d4227.tar.bz2
linux-stable-1c59e1edb13d60b97b7b03b332ceed5d967d4227.zip
Merge tag 'hwmon-for-linus-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon updates from Guenter Roeck: - new drivers for TMP108 and TC654 - hwmon core code cleanup - coretemp driver cleanup - fix overflow issues in several drivers - minor fixes, cleanups and enhancements in various drivers * tag 'hwmon-for-linus-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (41 commits) hwmon: (g762) Fix overflows and crash seen when writing limit attributes hwmon: (emcw201) Fix overflows seen when writing into limit attributes hwmon: (emc2103) Fix overflows seen when temperature limit attributes hwmon: (lm85) Fix overflows seen when writing voltage limit attributes hwmon: (lm87) Fix overflow seen when writing voltage limit attributes hwmon: (nct7802) Fix overflows seen when writing into limit attributes hwmon: (adt7470) Fix overflows seen when writing into limit attributes hwmon: (adt7462) Fix overflows seen when writing into limit attributes hwmon: (adm1026) Fix overflows seen when writing into limit attributes hwmon: (adm1025) Fix overflows seen when writing voltage limits hwmon: (via-cputemp) Convert to hotplug state machine devicetree: hwmon: Add documentation for TMP108 driver. hwmon: Add Texas Instruments TMP108 temperature sensor driver. hwmon: (core) Simplify sysfs attribute name allocation hwmon: (core) Rename groups parameter in API to extra_groups hwmon: (core) Explain why at least two attribute groups are allocated hwmon: (core) Make is_visible callback truly mandatory hwmon: (core) Deprecate hwmon_device_register() hwmon: (core) Clarify use of chip attributes hwmon: (core) Add support for string attributes to new API ...
Diffstat (limited to 'drivers/hwmon/smsc47m192.c')
-rw-r--r--drivers/hwmon/smsc47m192.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c
index 6ac7cda72d4c..15650f247679 100644
--- a/drivers/hwmon/smsc47m192.c
+++ b/drivers/hwmon/smsc47m192.c
@@ -77,14 +77,15 @@ static inline unsigned int IN_FROM_REG(u8 reg, int n)
static inline u8 IN_TO_REG(unsigned long val, int n)
{
- return clamp_val(SCALE(val, 192, nom_mv[n]), 0, 255);
+ val = clamp_val(val, 0, nom_mv[n] * 255 / 192);
+ return SCALE(val, 192, nom_mv[n]);
}
/*
* TEMP: 0.001 degC units (-128C to +127C)
* REG: 1C/bit, two's complement
*/
-static inline s8 TEMP_TO_REG(int val)
+static inline s8 TEMP_TO_REG(long val)
{
return SCALE(clamp_val(val, -128000, 127000), 1, 1000);
}