diff options
author | Guenter Roeck <linux@roeck-us.net> | 2013-01-09 11:09:34 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2013-01-26 00:03:54 -0500 |
commit | 2a844c148e1f714ebf42cb96e1b172ce394c36c9 (patch) | |
tree | eb68eb8438f0470e7a81b022199abe5f6d866879 /drivers/hwmon/lm85.c | |
parent | 142c090184ac7f9763c5d22509405da3486f9801 (diff) |
hwmon: Replace SENSORS_LIMIT with clamp_val
SENSORS_LIMIT and the generic clamp_val have the same functionality,
and clamp_val is more efficient.
This patch reduces text size by 9052 bytes and bss size by 11624 bytes
for x86_64 builds.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: George Joseph <george.joseph@fairview5.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/lm85.c')
-rw-r--r-- | drivers/hwmon/lm85.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 9f2dd77e1e0e..47ade8ba152d 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
@@ -139,7 +139,7 @@ static const int lm85_scaling[] = { /* .001 Volts */ | |||
139 | #define SCALE(val, from, to) (((val) * (to) + ((from) / 2)) / (from)) | 139 | #define SCALE(val, from, to) (((val) * (to) + ((from) / 2)) / (from)) |
140 | 140 | ||
141 | #define INS_TO_REG(n, val) \ | 141 | #define INS_TO_REG(n, val) \ |
142 | SENSORS_LIMIT(SCALE(val, lm85_scaling[n], 192), 0, 255) | 142 | clamp_val(SCALE(val, lm85_scaling[n], 192), 0, 255) |
143 | 143 | ||
144 | #define INSEXT_FROM_REG(n, val, ext) \ | 144 | #define INSEXT_FROM_REG(n, val, ext) \ |
145 | SCALE(((val) << 4) + (ext), 192 << 4, lm85_scaling[n]) | 145 | SCALE(((val) << 4) + (ext), 192 << 4, lm85_scaling[n]) |
@@ -151,19 +151,19 @@ static inline u16 FAN_TO_REG(unsigned long val) | |||
151 | { | 151 | { |
152 | if (!val) | 152 | if (!val) |
153 | return 0xffff; | 153 | return 0xffff; |
154 | return SENSORS_LIMIT(5400000 / val, 1, 0xfffe); | 154 | return clamp_val(5400000 / val, 1, 0xfffe); |
155 | } | 155 | } |
156 | #define FAN_FROM_REG(val) ((val) == 0 ? -1 : (val) == 0xffff ? 0 : \ | 156 | #define FAN_FROM_REG(val) ((val) == 0 ? -1 : (val) == 0xffff ? 0 : \ |
157 | 5400000 / (val)) | 157 | 5400000 / (val)) |
158 | 158 | ||
159 | /* Temperature is reported in .001 degC increments */ | 159 | /* Temperature is reported in .001 degC increments */ |
160 | #define TEMP_TO_REG(val) \ | 160 | #define TEMP_TO_REG(val) \ |
161 | SENSORS_LIMIT(SCALE(val, 1000, 1), -127, 127) | 161 | clamp_val(SCALE(val, 1000, 1), -127, 127) |
162 | #define TEMPEXT_FROM_REG(val, ext) \ | 162 | #define TEMPEXT_FROM_REG(val, ext) \ |
163 | SCALE(((val) << 4) + (ext), 16, 1000) | 163 | SCALE(((val) << 4) + (ext), 16, 1000) |
164 | #define TEMP_FROM_REG(val) ((val) * 1000) | 164 | #define TEMP_FROM_REG(val) ((val) * 1000) |
165 | 165 | ||
166 | #define PWM_TO_REG(val) SENSORS_LIMIT(val, 0, 255) | 166 | #define PWM_TO_REG(val) clamp_val(val, 0, 255) |
167 | #define PWM_FROM_REG(val) (val) | 167 | #define PWM_FROM_REG(val) (val) |
168 | 168 | ||
169 | 169 | ||
@@ -258,7 +258,7 @@ static int ZONE_TO_REG(int zone) | |||
258 | return i << 5; | 258 | return i << 5; |
259 | } | 259 | } |
260 | 260 | ||
261 | #define HYST_TO_REG(val) SENSORS_LIMIT(((val) + 500) / 1000, 0, 15) | 261 | #define HYST_TO_REG(val) clamp_val(((val) + 500) / 1000, 0, 15) |
262 | #define HYST_FROM_REG(val) ((val) * 1000) | 262 | #define HYST_FROM_REG(val) ((val) * 1000) |
263 | 263 | ||
264 | /* | 264 | /* |