提交 ceeaa70c 编写于 作者: G Guenter Roeck

hwmon: (emc1403) Relax hysteresis limit write checks

Writing the hysteresis limit returned -ERANGE if the written hysteresis
was too high or too low. Relax error check and adjust the hysteresis
value to its valid range.
Reviewed-by: NJean Delvare <jdelvare@suse.de>
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
上级 84899d39
......@@ -147,12 +147,7 @@ static ssize_t store_hyst(struct device *dev,
goto fail;
hyst = limit * 1000 - val;
hyst = DIV_ROUND_CLOSEST(hyst, 1000);
if (hyst < 0 || hyst > 255) {
retval = -ERANGE;
goto fail;
}
hyst = clamp_val(DIV_ROUND_CLOSEST(hyst, 1000), 0, 255);
retval = regmap_write(regmap, 0x21, hyst);
if (retval == 0)
retval = count;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部