Commit 051c2a9f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fix from Guenter Roeck:
 "Fixes to temperature limit and vrm write operations in smsc47m192
  driver"

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (smsc47m192) Fix temperature limit and vrm write operations
parents edffe1b6 043572d5
...@@ -86,7 +86,7 @@ static inline u8 IN_TO_REG(unsigned long val, int n) ...@@ -86,7 +86,7 @@ static inline u8 IN_TO_REG(unsigned long val, int n)
*/ */
static inline s8 TEMP_TO_REG(int val) static inline s8 TEMP_TO_REG(int val)
{ {
return clamp_val(SCALE(val, 1, 1000), -128000, 127000); return SCALE(clamp_val(val, -128000, 127000), 1, 1000);
} }
static inline int TEMP_FROM_REG(s8 val) static inline int TEMP_FROM_REG(s8 val)
...@@ -384,6 +384,8 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, ...@@ -384,6 +384,8 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
err = kstrtoul(buf, 10, &val); err = kstrtoul(buf, 10, &val);
if (err) if (err)
return err; return err;
if (val > 255)
return -EINVAL;
data->vrm = val; data->vrm = val;
return count; return count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment