qlcnic: Bump up the version to 5.1.35
[firefly-linux-kernel-4.4.55.git] / drivers / hwmon / w83793.c
index 99799fd1d917ce5a451f6a14cbf2c6da72f6a2e6..660427520c539a6993207862bdae6d2247fb2924 100644 (file)
@@ -191,7 +191,7 @@ static inline u16 FAN_TO_REG(long rpm)
 {
        if (rpm <= 0)
                return 0x0fff;
-       return SENSORS_LIMIT((1350000 + (rpm >> 1)) / rpm, 1, 0xffe);
+       return clamp_val((1350000 + (rpm >> 1)) / rpm, 1, 0xffe);
 }
 
 static inline unsigned long TIME_FROM_REG(u8 reg)
@@ -201,7 +201,7 @@ static inline unsigned long TIME_FROM_REG(u8 reg)
 
 static inline u8 TIME_TO_REG(unsigned long val)
 {
-       return SENSORS_LIMIT((val + 50) / 100, 0, 0xff);
+       return clamp_val((val + 50) / 100, 0, 0xff);
 }
 
 static inline long TEMP_FROM_REG(s8 reg)
@@ -211,7 +211,7 @@ static inline long TEMP_FROM_REG(s8 reg)
 
 static inline s8 TEMP_TO_REG(long val, s8 min, s8 max)
 {
-       return SENSORS_LIMIT((val + (val < 0 ? -500 : 500)) / 1000, min, max);
+       return clamp_val((val + (val < 0 ? -500 : 500)) / 1000, min, max);
 }
 
 struct w83793_data {
@@ -558,7 +558,7 @@ store_pwm(struct device *dev, struct device_attribute *attr,
                w83793_write_value(client, W83793_REG_PWM_STOP_TIME(index),
                                   val);
        } else {
-               val = SENSORS_LIMIT(val, 0, 0xff) >> 2;
+               val = clamp_val(val, 0, 0xff) >> 2;
                data->pwm[index][nr] =
                    w83793_read_value(client, W83793_REG_PWM(index, nr)) & 0xc0;
                data->pwm[index][nr] |= val;
@@ -739,7 +739,7 @@ store_sf_setup(struct device *dev, struct device_attribute *attr,
        if (nr == SETUP_PWM_DEFAULT) {
                data->pwm_default =
                    w83793_read_value(client, W83793_REG_PWM_DEFAULT) & 0xc0;
-               data->pwm_default |= SENSORS_LIMIT(val, 0, 0xff) >> 2;
+               data->pwm_default |= clamp_val(val, 0, 0xff) >> 2;
                w83793_write_value(client, W83793_REG_PWM_DEFAULT,
                                                        data->pwm_default);
        } else if (nr == SETUP_PWM_UPTIME) {
@@ -838,7 +838,7 @@ store_sf_ctrl(struct device *dev, struct device_attribute *attr,
 
        mutex_lock(&data->update_lock);
        if (nr == TEMP_FAN_MAP) {
-               val = SENSORS_LIMIT(val, 0, 255);
+               val = clamp_val(val, 0, 255);
                w83793_write_value(client, W83793_REG_TEMP_FAN_MAP(index), val);
                data->temp_fan_map[index] = val;
        } else if (nr == TEMP_PWM_ENABLE) {
@@ -907,7 +907,7 @@ store_sf2_pwm(struct device *dev, struct device_attribute *attr,
        err = kstrtoul(buf, 10, &val);
        if (err)
                return err;
-       val = SENSORS_LIMIT(val, 0, 0xff) >> 2;
+       val = clamp_val(val, 0, 0xff) >> 2;
 
        mutex_lock(&data->update_lock);
        data->sf2_pwm[index][nr] =
@@ -1003,9 +1003,9 @@ store_in(struct device *dev, struct device_attribute *attr,
                /* fix the limit values of 5VDD and 5VSB to ALARM mechanism */
                if (nr == 1 || nr == 2)
                        val -= scale_in_add[index] / scale_in[index];
-               val = SENSORS_LIMIT(val, 0, 255);
+               val = clamp_val(val, 0, 255);
        } else {
-               val = SENSORS_LIMIT(val, 0, 0x3FF);
+               val = clamp_val(val, 0, 0x3FF);
                data->in_low_bits[nr] =
                    w83793_read_value(client, W83793_REG_IN_LOW_BITS[nr]);
                data->in_low_bits[nr] &= ~(0x03 << (2 * index));