diff options
Diffstat (limited to 'drivers/hwmon/via686a.c')
-rw-r--r-- | drivers/hwmon/via686a.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index e0e14a9f1658..3123b30208c5 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -135,17 +135,14 @@ static inline u8 IN_TO_REG(long val, int inNum) | |||
135 | * for the constants. | 135 | * for the constants. |
136 | */ | 136 | */ |
137 | if (inNum <= 1) | 137 | if (inNum <= 1) |
138 | return (u8) | 138 | return (u8) clamp_val((val * 21024 - 1205000) / 250000, 0, 255); |
139 | SENSORS_LIMIT((val * 21024 - 1205000) / 250000, 0, 255); | ||
140 | else if (inNum == 2) | 139 | else if (inNum == 2) |
141 | return (u8) | 140 | return (u8) clamp_val((val * 15737 - 1205000) / 250000, 0, 255); |
142 | SENSORS_LIMIT((val * 15737 - 1205000) / 250000, 0, 255); | ||
143 | else if (inNum == 3) | 141 | else if (inNum == 3) |
144 | return (u8) | 142 | return (u8) clamp_val((val * 10108 - 1205000) / 250000, 0, 255); |
145 | SENSORS_LIMIT((val * 10108 - 1205000) / 250000, 0, 255); | ||
146 | else | 143 | else |
147 | return (u8) | 144 | return (u8) clamp_val((val * 41714 - 12050000) / 2500000, 0, |
148 | SENSORS_LIMIT((val * 41714 - 12050000) / 2500000, 0, 255); | 145 | 255); |
149 | } | 146 | } |
150 | 147 | ||
151 | static inline long IN_FROM_REG(u8 val, int inNum) | 148 | static inline long IN_FROM_REG(u8 val, int inNum) |
@@ -175,8 +172,8 @@ static inline u8 FAN_TO_REG(long rpm, int div) | |||
175 | { | 172 | { |
176 | if (rpm == 0) | 173 | if (rpm == 0) |
177 | return 0; | 174 | return 0; |
178 | rpm = SENSORS_LIMIT(rpm, 1, 1000000); | 175 | rpm = clamp_val(rpm, 1, 1000000); |
179 | return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, 255); | 176 | return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 255); |
180 | } | 177 | } |
181 | 178 | ||
182 | #define FAN_FROM_REG(val, div) ((val) == 0 ? 0 : (val) == 255 ? 0 : 1350000 / \ | 179 | #define FAN_FROM_REG(val, div) ((val) == 0 ? 0 : (val) == 255 ? 0 : 1350000 / \ |