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/lm80.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/lm80.c')
-rw-r--r-- | drivers/hwmon/lm80.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c index 28a8b71f4571..357fbb998728 100644 --- a/drivers/hwmon/lm80.c +++ b/drivers/hwmon/lm80.c @@ -72,15 +72,15 @@ static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, * Fixing this is just not worth it. */ -#define IN_TO_REG(val) (SENSORS_LIMIT(((val) + 5) / 10, 0, 255)) +#define IN_TO_REG(val) (clamp_val(((val) + 5) / 10, 0, 255)) #define IN_FROM_REG(val) ((val) * 10) static inline unsigned char FAN_TO_REG(unsigned rpm, unsigned div) { if (rpm == 0) return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, 254); + rpm = clamp_val(rpm, 1, 1000000); + return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254); } #define FAN_FROM_REG(val, div) ((val) == 0 ? -1 : \ @@ -102,7 +102,7 @@ static inline long TEMP_FROM_REG(u16 temp) #define TEMP_LIMIT_FROM_REG(val) (((val) > 0x80 ? \ (val) - 0x100 : (val)) * 1000) -#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT((val) < 0 ? \ +#define TEMP_LIMIT_TO_REG(val) clamp_val((val) < 0 ? \ ((val) - 500) / 1000 : ((val) + 500) / 1000, 0, 255) #define DIV_FROM_REG(val) (1 << (val)) |