diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-01-30 10:57:22 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-01-30 10:57:22 +0300 |
commit | 1b62d134d3c5f9e67de096af7ea3e9fe48966f17 (patch) | |
tree | be30467e997cc8ba0d350309dd498f00cb69969b /drivers/hwmon/nct7802.c | |
parent | 7a37052adb5e843bcfff6c98aee9b60bb087b910 (diff) | |
parent | e9ca038a94f5a41c0689c5f441fd9c5a567e6f39 (diff) | |
download | linux-1b62d134d3c5f9e67de096af7ea3e9fe48966f17.tar.xz |
Merge back earlier ACPICA changes for v4.11.
Diffstat (limited to 'drivers/hwmon/nct7802.c')
-rw-r--r-- | drivers/hwmon/nct7802.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c index 3ce33d244cc0..12b94b094c0d 100644 --- a/drivers/hwmon/nct7802.c +++ b/drivers/hwmon/nct7802.c @@ -259,13 +259,15 @@ static int nct7802_read_fan_min(struct nct7802_data *data, u8 reg_fan_low, ret = 0; else if (ret) ret = DIV_ROUND_CLOSEST(1350000U, ret); + else + ret = 1350000U; abort: mutex_unlock(&data->access_lock); return ret; } static int nct7802_write_fan_min(struct nct7802_data *data, u8 reg_fan_low, - u8 reg_fan_high, unsigned int limit) + u8 reg_fan_high, unsigned long limit) { int err; @@ -326,8 +328,8 @@ static int nct7802_write_voltage(struct nct7802_data *data, int nr, int index, int shift = 8 - REG_VOLTAGE_LIMIT_MSB_SHIFT[index - 1][nr]; int err; + voltage = clamp_val(voltage, 0, 0x3ff * nct7802_vmul[nr]); voltage = DIV_ROUND_CLOSEST(voltage, nct7802_vmul[nr]); - voltage = clamp_val(voltage, 0, 0x3ff); mutex_lock(&data->access_lock); err = regmap_write(data->regmap, @@ -402,7 +404,7 @@ static ssize_t store_temp(struct device *dev, struct device_attribute *attr, if (err < 0) return err; - val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -128, 127); + val = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000); err = regmap_write(data->regmap, nr, val & 0xff); return err ? : count; |