diff options
author | Guenter Roeck <linux@roeck-us.net> | 2013-01-09 08:09:34 -0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2013-01-25 21:03:54 -0800 |
commit | 2a844c148e1f714ebf42cb96e1b172ce394c36c9 (patch) | |
tree | eb68eb8438f0470e7a81b022199abe5f6d866879 /drivers/hwmon/via686a.c | |
parent | 142c090184ac7f9763c5d22509405da3486f9801 (diff) | |
download | talos-op-linux-2a844c148e1f714ebf42cb96e1b172ce394c36c9.tar.gz talos-op-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/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) * for the constants. */ if (inNum <= 1) - return (u8) - SENSORS_LIMIT((val * 21024 - 1205000) / 250000, 0, 255); + return (u8) clamp_val((val * 21024 - 1205000) / 250000, 0, 255); else if (inNum == 2) - return (u8) - SENSORS_LIMIT((val * 15737 - 1205000) / 250000, 0, 255); + return (u8) clamp_val((val * 15737 - 1205000) / 250000, 0, 255); else if (inNum == 3) - return (u8) - SENSORS_LIMIT((val * 10108 - 1205000) / 250000, 0, 255); + return (u8) clamp_val((val * 10108 - 1205000) / 250000, 0, 255); else - return (u8) - SENSORS_LIMIT((val * 41714 - 12050000) / 2500000, 0, 255); + return (u8) clamp_val((val * 41714 - 12050000) / 2500000, 0, + 255); } static inline long IN_FROM_REG(u8 val, int inNum) @@ -175,8 +172,8 @@ static inline u8 FAN_TO_REG(long rpm, int div) { if (rpm == 0) return 0; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, 255); + rpm = clamp_val(rpm, 1, 1000000); + return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 255); } #define FAN_FROM_REG(val, div) ((val) == 0 ? 0 : (val) == 255 ? 0 : 1350000 / \ |