aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f71882fg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/f71882fg.c')
-rw-r--r--drivers/hwmon/f71882fg.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index bb7275cc47f3..cfb02dd91aad 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -1350,7 +1350,7 @@ static ssize_t store_fan_full_speed(struct device *dev,
1350 if (err) 1350 if (err)
1351 return err; 1351 return err;
1352 1352
1353 val = SENSORS_LIMIT(val, 23, 1500000); 1353 val = clamp_val(val, 23, 1500000);
1354 val = fan_to_reg(val); 1354 val = fan_to_reg(val);
1355 1355
1356 mutex_lock(&data->update_lock); 1356 mutex_lock(&data->update_lock);
@@ -1438,7 +1438,7 @@ static ssize_t store_in_max(struct device *dev, struct device_attribute
1438 return err; 1438 return err;
1439 1439
1440 val /= 8; 1440 val /= 8;
1441 val = SENSORS_LIMIT(val, 0, 255); 1441 val = clamp_val(val, 0, 255);
1442 1442
1443 mutex_lock(&data->update_lock); 1443 mutex_lock(&data->update_lock);
1444 f71882fg_write8(data, F71882FG_REG_IN1_HIGH, val); 1444 f71882fg_write8(data, F71882FG_REG_IN1_HIGH, val);
@@ -1542,7 +1542,7 @@ static ssize_t store_temp_max(struct device *dev, struct device_attribute
1542 return err; 1542 return err;
1543 1543
1544 val /= 1000; 1544 val /= 1000;
1545 val = SENSORS_LIMIT(val, 0, 255); 1545 val = clamp_val(val, 0, 255);
1546 1546
1547 mutex_lock(&data->update_lock); 1547 mutex_lock(&data->update_lock);
1548 f71882fg_write8(data, F71882FG_REG_TEMP_HIGH(nr), val); 1548 f71882fg_write8(data, F71882FG_REG_TEMP_HIGH(nr), val);
@@ -1589,8 +1589,7 @@ static ssize_t store_temp_max_hyst(struct device *dev, struct device_attribute
1589 1589
1590 /* convert abs to relative and check */ 1590 /* convert abs to relative and check */
1591 data->temp_high[nr] = f71882fg_read8(data, F71882FG_REG_TEMP_HIGH(nr)); 1591 data->temp_high[nr] = f71882fg_read8(data, F71882FG_REG_TEMP_HIGH(nr));
1592 val = SENSORS_LIMIT(val, data->temp_high[nr] - 15, 1592 val = clamp_val(val, data->temp_high[nr] - 15, data->temp_high[nr]);
1593 data->temp_high[nr]);
1594 val = data->temp_high[nr] - val; 1593 val = data->temp_high[nr] - val;
1595 1594
1596 /* convert value to register contents */ 1595 /* convert value to register contents */
@@ -1627,7 +1626,7 @@ static ssize_t store_temp_crit(struct device *dev, struct device_attribute
1627 return err; 1626 return err;
1628 1627
1629 val /= 1000; 1628 val /= 1000;
1630 val = SENSORS_LIMIT(val, 0, 255); 1629 val = clamp_val(val, 0, 255);
1631 1630
1632 mutex_lock(&data->update_lock); 1631 mutex_lock(&data->update_lock);
1633 f71882fg_write8(data, F71882FG_REG_TEMP_OVT(nr), val); 1632 f71882fg_write8(data, F71882FG_REG_TEMP_OVT(nr), val);
@@ -1754,7 +1753,7 @@ static ssize_t store_pwm(struct device *dev,
1754 if (err) 1753 if (err)
1755 return err; 1754 return err;
1756 1755
1757 val = SENSORS_LIMIT(val, 0, 255); 1756 val = clamp_val(val, 0, 255);
1758 1757
1759 mutex_lock(&data->update_lock); 1758 mutex_lock(&data->update_lock);
1760 data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE); 1759 data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
@@ -1805,7 +1804,7 @@ static ssize_t store_simple_pwm(struct device *dev,
1805 if (err) 1804 if (err)
1806 return err; 1805 return err;
1807 1806
1808 val = SENSORS_LIMIT(val, 0, 255); 1807 val = clamp_val(val, 0, 255);
1809 1808
1810 mutex_lock(&data->update_lock); 1809 mutex_lock(&data->update_lock);
1811 f71882fg_write8(data, F71882FG_REG_PWM(nr), val); 1810 f71882fg_write8(data, F71882FG_REG_PWM(nr), val);
@@ -1932,7 +1931,7 @@ static ssize_t store_pwm_auto_point_pwm(struct device *dev,
1932 if (err) 1931 if (err)
1933 return err; 1932 return err;
1934 1933
1935 val = SENSORS_LIMIT(val, 0, 255); 1934 val = clamp_val(val, 0, 255);
1936 1935
1937 mutex_lock(&data->update_lock); 1936 mutex_lock(&data->update_lock);
1938 data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE); 1937 data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
@@ -1991,8 +1990,8 @@ static ssize_t store_pwm_auto_point_temp_hyst(struct device *dev,
1991 mutex_lock(&data->update_lock); 1990 mutex_lock(&data->update_lock);
1992 data->pwm_auto_point_temp[nr][point] = 1991 data->pwm_auto_point_temp[nr][point] =
1993 f71882fg_read8(data, F71882FG_REG_POINT_TEMP(nr, point)); 1992 f71882fg_read8(data, F71882FG_REG_POINT_TEMP(nr, point));
1994 val = SENSORS_LIMIT(val, data->pwm_auto_point_temp[nr][point] - 15, 1993 val = clamp_val(val, data->pwm_auto_point_temp[nr][point] - 15,
1995 data->pwm_auto_point_temp[nr][point]); 1994 data->pwm_auto_point_temp[nr][point]);
1996 val = data->pwm_auto_point_temp[nr][point] - val; 1995 val = data->pwm_auto_point_temp[nr][point] - val;
1997 1996
1998 reg = f71882fg_read8(data, F71882FG_REG_FAN_HYST(nr / 2)); 1997 reg = f71882fg_read8(data, F71882FG_REG_FAN_HYST(nr / 2));
@@ -2126,9 +2125,9 @@ static ssize_t store_pwm_auto_point_temp(struct device *dev,
2126 val /= 1000; 2125 val /= 1000;
2127 2126
2128 if (data->auto_point_temp_signed) 2127 if (data->auto_point_temp_signed)
2129 val = SENSORS_LIMIT(val, -128, 127); 2128 val = clamp_val(val, -128, 127);
2130 else 2129 else
2131 val = SENSORS_LIMIT(val, 0, 127); 2130 val = clamp_val(val, 0, 127);
2132 2131
2133 mutex_lock(&data->update_lock); 2132 mutex_lock(&data->update_lock);
2134 f71882fg_write8(data, F71882FG_REG_POINT_TEMP(pwm, point), val); 2133 f71882fg_write8(data, F71882FG_REG_POINT_TEMP(pwm, point), val);