diff options
author | Guenter Roeck <linux@roeck-us.net> | 2013-01-09 17:09:34 +0100 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2013-01-26 06:03:54 +0100 |
commit | 2a844c148e1f714ebf42cb96e1b172ce394c36c9 (patch) | |
tree | eb68eb8438f0470e7a81b022199abe5f6d866879 /drivers/hwmon/lm85.c | |
parent | hwmon: (sht15) avoid CamelCase (diff) | |
download | linux-2a844c148e1f714ebf42cb96e1b172ce394c36c9.tar.xz linux-2a844c148e1f714ebf42cb96e1b172ce394c36c9.zip |
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 */ #define SCALE(val, from, to) (((val) * (to) + ((from) / 2)) / (from)) #define INS_TO_REG(n, val) \ - SENSORS_LIMIT(SCALE(val, lm85_scaling[n], 192), 0, 255) + clamp_val(SCALE(val, lm85_scaling[n], 192), 0, 255) #define INSEXT_FROM_REG(n, val, ext) \ SCALE(((val) << 4) + (ext), 192 << 4, lm85_scaling[n]) @@ -151,19 +151,19 @@ static inline u16 FAN_TO_REG(unsigned long val) { if (!val) return 0xffff; - return SENSORS_LIMIT(5400000 / val, 1, 0xfffe); + return clamp_val(5400000 / val, 1, 0xfffe); } #define FAN_FROM_REG(val) ((val) == 0 ? -1 : (val) == 0xffff ? 0 : \ 5400000 / (val)) /* Temperature is reported in .001 degC increments */ #define TEMP_TO_REG(val) \ - SENSORS_LIMIT(SCALE(val, 1000, 1), -127, 127) + 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) -#define PWM_TO_REG(val) SENSORS_LIMIT(val, 0, 255) +#define PWM_TO_REG(val) clamp_val(val, 0, 255) #define PWM_FROM_REG(val) (val) @@ -258,7 +258,7 @@ static int ZONE_TO_REG(int zone) return i << 5; } -#define HYST_TO_REG(val) SENSORS_LIMIT(((val) + 500) / 1000, 0, 15) +#define HYST_TO_REG(val) clamp_val(((val) + 500) / 1000, 0, 15) #define HYST_FROM_REG(val) ((val) * 1000) /* |