diff options
Diffstat (limited to 'drivers/hwmon/adt7462.c')
-rw-r--r-- | drivers/hwmon/adt7462.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c index 98a7d81e25c5..69481d3a3d23 100644 --- a/drivers/hwmon/adt7462.c +++ b/drivers/hwmon/adt7462.c | |||
@@ -836,7 +836,7 @@ static ssize_t set_temp_min(struct device *dev, | |||
836 | return -EINVAL; | 836 | return -EINVAL; |
837 | 837 | ||
838 | temp = DIV_ROUND_CLOSEST(temp, 1000) + 64; | 838 | temp = DIV_ROUND_CLOSEST(temp, 1000) + 64; |
839 | temp = SENSORS_LIMIT(temp, 0, 255); | 839 | temp = clamp_val(temp, 0, 255); |
840 | 840 | ||
841 | mutex_lock(&data->lock); | 841 | mutex_lock(&data->lock); |
842 | data->temp_min[attr->index] = temp; | 842 | data->temp_min[attr->index] = temp; |
@@ -874,7 +874,7 @@ static ssize_t set_temp_max(struct device *dev, | |||
874 | return -EINVAL; | 874 | return -EINVAL; |
875 | 875 | ||
876 | temp = DIV_ROUND_CLOSEST(temp, 1000) + 64; | 876 | temp = DIV_ROUND_CLOSEST(temp, 1000) + 64; |
877 | temp = SENSORS_LIMIT(temp, 0, 255); | 877 | temp = clamp_val(temp, 0, 255); |
878 | 878 | ||
879 | mutex_lock(&data->lock); | 879 | mutex_lock(&data->lock); |
880 | data->temp_max[attr->index] = temp; | 880 | data->temp_max[attr->index] = temp; |
@@ -939,7 +939,7 @@ static ssize_t set_volt_max(struct device *dev, | |||
939 | 939 | ||
940 | temp *= 1000; /* convert mV to uV */ | 940 | temp *= 1000; /* convert mV to uV */ |
941 | temp = DIV_ROUND_CLOSEST(temp, x); | 941 | temp = DIV_ROUND_CLOSEST(temp, x); |
942 | temp = SENSORS_LIMIT(temp, 0, 255); | 942 | temp = clamp_val(temp, 0, 255); |
943 | 943 | ||
944 | mutex_lock(&data->lock); | 944 | mutex_lock(&data->lock); |
945 | data->volt_max[attr->index] = temp; | 945 | data->volt_max[attr->index] = temp; |
@@ -981,7 +981,7 @@ static ssize_t set_volt_min(struct device *dev, | |||
981 | 981 | ||
982 | temp *= 1000; /* convert mV to uV */ | 982 | temp *= 1000; /* convert mV to uV */ |
983 | temp = DIV_ROUND_CLOSEST(temp, x); | 983 | temp = DIV_ROUND_CLOSEST(temp, x); |
984 | temp = SENSORS_LIMIT(temp, 0, 255); | 984 | temp = clamp_val(temp, 0, 255); |
985 | 985 | ||
986 | mutex_lock(&data->lock); | 986 | mutex_lock(&data->lock); |
987 | data->volt_min[attr->index] = temp; | 987 | data->volt_min[attr->index] = temp; |
@@ -1071,7 +1071,7 @@ static ssize_t set_fan_min(struct device *dev, | |||
1071 | 1071 | ||
1072 | temp = FAN_RPM_TO_PERIOD(temp); | 1072 | temp = FAN_RPM_TO_PERIOD(temp); |
1073 | temp >>= 8; | 1073 | temp >>= 8; |
1074 | temp = SENSORS_LIMIT(temp, 1, 255); | 1074 | temp = clamp_val(temp, 1, 255); |
1075 | 1075 | ||
1076 | mutex_lock(&data->lock); | 1076 | mutex_lock(&data->lock); |
1077 | data->fan_min[attr->index] = temp; | 1077 | data->fan_min[attr->index] = temp; |
@@ -1149,7 +1149,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, | |||
1149 | if (kstrtol(buf, 10, &temp)) | 1149 | if (kstrtol(buf, 10, &temp)) |
1150 | return -EINVAL; | 1150 | return -EINVAL; |
1151 | 1151 | ||
1152 | temp = SENSORS_LIMIT(temp, 0, 255); | 1152 | temp = clamp_val(temp, 0, 255); |
1153 | 1153 | ||
1154 | mutex_lock(&data->lock); | 1154 | mutex_lock(&data->lock); |
1155 | data->pwm[attr->index] = temp; | 1155 | data->pwm[attr->index] = temp; |
@@ -1179,7 +1179,7 @@ static ssize_t set_pwm_max(struct device *dev, | |||
1179 | if (kstrtol(buf, 10, &temp)) | 1179 | if (kstrtol(buf, 10, &temp)) |
1180 | return -EINVAL; | 1180 | return -EINVAL; |
1181 | 1181 | ||
1182 | temp = SENSORS_LIMIT(temp, 0, 255); | 1182 | temp = clamp_val(temp, 0, 255); |
1183 | 1183 | ||
1184 | mutex_lock(&data->lock); | 1184 | mutex_lock(&data->lock); |
1185 | data->pwm_max = temp; | 1185 | data->pwm_max = temp; |
@@ -1211,7 +1211,7 @@ static ssize_t set_pwm_min(struct device *dev, | |||
1211 | if (kstrtol(buf, 10, &temp)) | 1211 | if (kstrtol(buf, 10, &temp)) |
1212 | return -EINVAL; | 1212 | return -EINVAL; |
1213 | 1213 | ||
1214 | temp = SENSORS_LIMIT(temp, 0, 255); | 1214 | temp = clamp_val(temp, 0, 255); |
1215 | 1215 | ||
1216 | mutex_lock(&data->lock); | 1216 | mutex_lock(&data->lock); |
1217 | data->pwm_min[attr->index] = temp; | 1217 | data->pwm_min[attr->index] = temp; |
@@ -1246,7 +1246,7 @@ static ssize_t set_pwm_hyst(struct device *dev, | |||
1246 | return -EINVAL; | 1246 | return -EINVAL; |
1247 | 1247 | ||
1248 | temp = DIV_ROUND_CLOSEST(temp, 1000); | 1248 | temp = DIV_ROUND_CLOSEST(temp, 1000); |
1249 | temp = SENSORS_LIMIT(temp, 0, 15); | 1249 | temp = clamp_val(temp, 0, 15); |
1250 | 1250 | ||
1251 | /* package things up */ | 1251 | /* package things up */ |
1252 | temp &= ADT7462_PWM_HYST_MASK; | 1252 | temp &= ADT7462_PWM_HYST_MASK; |
@@ -1333,7 +1333,7 @@ static ssize_t set_pwm_tmin(struct device *dev, | |||
1333 | return -EINVAL; | 1333 | return -EINVAL; |
1334 | 1334 | ||
1335 | temp = DIV_ROUND_CLOSEST(temp, 1000) + 64; | 1335 | temp = DIV_ROUND_CLOSEST(temp, 1000) + 64; |
1336 | temp = SENSORS_LIMIT(temp, 0, 255); | 1336 | temp = clamp_val(temp, 0, 255); |
1337 | 1337 | ||
1338 | mutex_lock(&data->lock); | 1338 | mutex_lock(&data->lock); |
1339 | data->pwm_tmin[attr->index] = temp; | 1339 | data->pwm_tmin[attr->index] = temp; |