Revert "hwmon: (adc128d818) Fix underflows seen when writing limit attributes"
This reverts commit d38974018c
.
This commit is contained in:
parent
849562406e
commit
6eb656e2e3
1 changed files with 2 additions and 2 deletions
|
@ -176,7 +176,7 @@ static ssize_t adc128_in_store(struct device *dev,
|
||||||
|
|
||||||
mutex_lock(&data->update_lock);
|
mutex_lock(&data->update_lock);
|
||||||
/* 10 mV LSB on limit registers */
|
/* 10 mV LSB on limit registers */
|
||||||
regval = DIV_ROUND_CLOSEST(clamp_val(val, 0, 2550), 10);
|
regval = clamp_val(DIV_ROUND_CLOSEST(val, 10), 0, 255);
|
||||||
data->in[index][nr] = regval << 4;
|
data->in[index][nr] = regval << 4;
|
||||||
reg = index == 1 ? ADC128_REG_IN_MIN(nr) : ADC128_REG_IN_MAX(nr);
|
reg = index == 1 ? ADC128_REG_IN_MIN(nr) : ADC128_REG_IN_MAX(nr);
|
||||||
i2c_smbus_write_byte_data(data->client, reg, regval);
|
i2c_smbus_write_byte_data(data->client, reg, regval);
|
||||||
|
@ -214,7 +214,7 @@ static ssize_t adc128_temp_store(struct device *dev,
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
mutex_lock(&data->update_lock);
|
mutex_lock(&data->update_lock);
|
||||||
regval = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000);
|
regval = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -128, 127);
|
||||||
data->temp[index] = regval << 1;
|
data->temp[index] = regval << 1;
|
||||||
i2c_smbus_write_byte_data(data->client,
|
i2c_smbus_write_byte_data(data->client,
|
||||||
index == 1 ? ADC128_REG_TEMP_MAX
|
index == 1 ? ADC128_REG_TEMP_MAX
|
||||||
|
|
Loading…
Reference in a new issue