aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/tmp401.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/tmp401.c')
-rw-r--r--drivers/hwmon/tmp401.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
index e62054875164..c85f6967ccc3 100644
--- a/drivers/hwmon/tmp401.c
+++ b/drivers/hwmon/tmp401.c
@@ -142,10 +142,10 @@ static int tmp401_register_to_temp(u16 reg, u8 config)
142static u16 tmp401_temp_to_register(long temp, u8 config) 142static u16 tmp401_temp_to_register(long temp, u8 config)
143{ 143{
144 if (config & TMP401_CONFIG_RANGE) { 144 if (config & TMP401_CONFIG_RANGE) {
145 temp = SENSORS_LIMIT(temp, -64000, 191000); 145 temp = clamp_val(temp, -64000, 191000);
146 temp += 64000; 146 temp += 64000;
147 } else 147 } else
148 temp = SENSORS_LIMIT(temp, 0, 127000); 148 temp = clamp_val(temp, 0, 127000);
149 149
150 return (temp * 160 + 312) / 625; 150 return (temp * 160 + 312) / 625;
151} 151}
@@ -163,10 +163,10 @@ static int tmp401_crit_register_to_temp(u8 reg, u8 config)
163static u8 tmp401_crit_temp_to_register(long temp, u8 config) 163static u8 tmp401_crit_temp_to_register(long temp, u8 config)
164{ 164{
165 if (config & TMP401_CONFIG_RANGE) { 165 if (config & TMP401_CONFIG_RANGE) {
166 temp = SENSORS_LIMIT(temp, -64000, 191000); 166 temp = clamp_val(temp, -64000, 191000);
167 temp += 64000; 167 temp += 64000;
168 } else 168 } else
169 temp = SENSORS_LIMIT(temp, 0, 127000); 169 temp = clamp_val(temp, 0, 127000);
170 170
171 return (temp + 500) / 1000; 171 return (temp + 500) / 1000;
172} 172}
@@ -417,14 +417,14 @@ static ssize_t store_temp_crit_hyst(struct device *dev, struct device_attribute
417 return -EINVAL; 417 return -EINVAL;
418 418
419 if (data->config & TMP401_CONFIG_RANGE) 419 if (data->config & TMP401_CONFIG_RANGE)
420 val = SENSORS_LIMIT(val, -64000, 191000); 420 val = clamp_val(val, -64000, 191000);
421 else 421 else
422 val = SENSORS_LIMIT(val, 0, 127000); 422 val = clamp_val(val, 0, 127000);
423 423
424 mutex_lock(&data->update_lock); 424 mutex_lock(&data->update_lock);
425 temp = tmp401_crit_register_to_temp(data->temp_crit[index], 425 temp = tmp401_crit_register_to_temp(data->temp_crit[index],
426 data->config); 426 data->config);
427 val = SENSORS_LIMIT(val, temp - 255000, temp); 427 val = clamp_val(val, temp - 255000, temp);
428 reg = ((temp - val) + 500) / 1000; 428 reg = ((temp - val) + 500) / 1000;
429 429
430 i2c_smbus_write_byte_data(to_i2c_client(dev), 430 i2c_smbus_write_byte_data(to_i2c_client(dev),