aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/asb100.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/asb100.c')
-rw-r--r--drivers/hwmon/asb100.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c
index 520e5bf4f76d..6ac612cabda1 100644
--- a/drivers/hwmon/asb100.c
+++ b/drivers/hwmon/asb100.c
@@ -114,7 +114,7 @@ static const u16 asb100_reg_temp_hyst[] = {0, 0x3a, 0x153, 0x253, 0x19};
114 */ 114 */
115static u8 IN_TO_REG(unsigned val) 115static u8 IN_TO_REG(unsigned val)
116{ 116{
117 unsigned nval = SENSORS_LIMIT(val, ASB100_IN_MIN, ASB100_IN_MAX); 117 unsigned nval = clamp_val(val, ASB100_IN_MIN, ASB100_IN_MAX);
118 return (nval + 8) / 16; 118 return (nval + 8) / 16;
119} 119}
120 120
@@ -129,8 +129,8 @@ static u8 FAN_TO_REG(long rpm, int div)
129 return 0; 129 return 0;
130 if (rpm == 0) 130 if (rpm == 0)
131 return 255; 131 return 255;
132 rpm = SENSORS_LIMIT(rpm, 1, 1000000); 132 rpm = clamp_val(rpm, 1, 1000000);
133 return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, 254); 133 return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254);
134} 134}
135 135
136static int FAN_FROM_REG(u8 val, int div) 136static int FAN_FROM_REG(u8 val, int div)
@@ -148,7 +148,7 @@ static int FAN_FROM_REG(u8 val, int div)
148 */ 148 */
149static u8 TEMP_TO_REG(long temp) 149static u8 TEMP_TO_REG(long temp)
150{ 150{
151 int ntemp = SENSORS_LIMIT(temp, ASB100_TEMP_MIN, ASB100_TEMP_MAX); 151 int ntemp = clamp_val(temp, ASB100_TEMP_MIN, ASB100_TEMP_MAX);
152 ntemp += (ntemp < 0 ? -500 : 500); 152 ntemp += (ntemp < 0 ? -500 : 500);
153 return (u8)(ntemp / 1000); 153 return (u8)(ntemp / 1000);
154} 154}
@@ -164,7 +164,7 @@ static int TEMP_FROM_REG(u8 reg)
164 */ 164 */
165static u8 ASB100_PWM_TO_REG(int pwm) 165static u8 ASB100_PWM_TO_REG(int pwm)
166{ 166{
167 pwm = SENSORS_LIMIT(pwm, 0, 255); 167 pwm = clamp_val(pwm, 0, 255);
168 return (u8)(pwm / 16); 168 return (u8)(pwm / 16);
169} 169}
170 170