rk: revert to v3.10
[firefly-linux-kernel-4.4.55.git] / drivers / hwmon / lm85.c
index b9d6e7d0ba37c3207a0fe414c9199c93fb2f0111..3894c408fda3cedc1230742cc5c0a9a653227cd5 100644 (file)
@@ -158,7 +158,7 @@ static inline u16 FAN_TO_REG(unsigned long val)
 
 /* Temperature is reported in .001 degC increments */
 #define TEMP_TO_REG(val)       \
-               DIV_ROUND_CLOSEST(clamp_val((val), -127000, 127000), 1000)
+               clamp_val(SCALE(val, 1000, 1), -127, 127)
 #define TEMPEXT_FROM_REG(val, ext)     \
                SCALE(((val) << 4) + (ext), 16, 1000)
 #define TEMP_FROM_REG(val)     ((val) * 1000)
@@ -192,7 +192,7 @@ static const int lm85_range_map[] = {
        13300, 16000, 20000, 26600, 32000, 40000, 53300, 80000
 };
 
-static int RANGE_TO_REG(long range)
+static int RANGE_TO_REG(int range)
 {
        int i;
 
@@ -214,7 +214,7 @@ static const int adm1027_freq_map[8] = { /* 1 Hz */
        11, 15, 22, 29, 35, 44, 59, 88
 };
 
-static int FREQ_TO_REG(const int *map, unsigned long freq)
+static int FREQ_TO_REG(const int *map, int freq)
 {
        int i;
 
@@ -463,9 +463,6 @@ static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,
        if (err)
                return err;
 
-       if (val > 255)
-               return -EINVAL;
-
        data->vrm = val;
        return count;
 }