summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/jc42.c
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2015-01-23 10:27:03 +0100
committerGuenter Roeck <linux@roeck-us.net>2015-01-25 21:24:00 -0800
commit9130880a1c2de115d4a3af0f78b2a437a77a1b7e (patch)
tree1dc4c50b141f92fef4acd5589a979c1253d00f93 /drivers/hwmon/jc42.c
parent2c3b1189fdca2f512187a670aeb295f901c10d87 (diff)
downloadop-kernel-dev-9130880a1c2de115d4a3af0f78b2a437a77a1b7e.zip
op-kernel-dev-9130880a1c2de115d4a3af0f78b2a437a77a1b7e.tar.gz
hwmon: (jc42) Allow negative hysteresis temperatures
The driver supports negative high and critical limits, it can return negative hysteresis values, so there is no good reason to not let the user write negative hysteresis values. Signed-off-by: Jean Delvare <jdelvare@suse.de> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/jc42.c')
-rw-r--r--drivers/hwmon/jc42.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c
index a46cb65..996bdfd 100644
--- a/drivers/hwmon/jc42.c
+++ b/drivers/hwmon/jc42.c
@@ -304,15 +304,16 @@ static ssize_t set_temp_crit_hyst(struct device *dev,
const char *buf, size_t count)
{
struct jc42_data *data = dev_get_drvdata(dev);
- unsigned long val;
+ long val;
int diff, hyst;
int err;
int ret = count;
- if (kstrtoul(buf, 10, &val) < 0)
+ if (kstrtol(buf, 10, &val) < 0)
return -EINVAL;
- val = clamp_val(val, 0, JC42_TEMP_MAX);
+ val = clamp_val(val, (data->extended ? JC42_TEMP_MIN_EXTENDED :
+ JC42_TEMP_MIN) - 6000, JC42_TEMP_MAX);
diff = jc42_temp_from_reg(data->temp[t_crit]) - val;
hyst = 0;
OpenPOWER on IntegriCloud