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/w83793.c | |
parent | 142c090184ac7f9763c5d22509405da3486f9801 (diff) | |
download | blackbird-op-linux-2a844c148e1f714ebf42cb96e1b172ce394c36c9.tar.gz blackbird-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/w83793.c')
-rw-r--r-- | drivers/hwmon/w83793.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index 99799fd1d917..660427520c53 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c @@ -191,7 +191,7 @@ static inline u16 FAN_TO_REG(long rpm) { if (rpm <= 0) return 0x0fff; - return SENSORS_LIMIT((1350000 + (rpm >> 1)) / rpm, 1, 0xffe); + return clamp_val((1350000 + (rpm >> 1)) / rpm, 1, 0xffe); } static inline unsigned long TIME_FROM_REG(u8 reg) @@ -201,7 +201,7 @@ static inline unsigned long TIME_FROM_REG(u8 reg) static inline u8 TIME_TO_REG(unsigned long val) { - return SENSORS_LIMIT((val + 50) / 100, 0, 0xff); + return clamp_val((val + 50) / 100, 0, 0xff); } static inline long TEMP_FROM_REG(s8 reg) @@ -211,7 +211,7 @@ static inline long TEMP_FROM_REG(s8 reg) static inline s8 TEMP_TO_REG(long val, s8 min, s8 max) { - return SENSORS_LIMIT((val + (val < 0 ? -500 : 500)) / 1000, min, max); + return clamp_val((val + (val < 0 ? -500 : 500)) / 1000, min, max); } struct w83793_data { @@ -558,7 +558,7 @@ store_pwm(struct device *dev, struct device_attribute *attr, w83793_write_value(client, W83793_REG_PWM_STOP_TIME(index), val); } else { - val = SENSORS_LIMIT(val, 0, 0xff) >> 2; + val = clamp_val(val, 0, 0xff) >> 2; data->pwm[index][nr] = w83793_read_value(client, W83793_REG_PWM(index, nr)) & 0xc0; data->pwm[index][nr] |= val; @@ -739,7 +739,7 @@ store_sf_setup(struct device *dev, struct device_attribute *attr, if (nr == SETUP_PWM_DEFAULT) { data->pwm_default = w83793_read_value(client, W83793_REG_PWM_DEFAULT) & 0xc0; - data->pwm_default |= SENSORS_LIMIT(val, 0, 0xff) >> 2; + data->pwm_default |= clamp_val(val, 0, 0xff) >> 2; w83793_write_value(client, W83793_REG_PWM_DEFAULT, data->pwm_default); } else if (nr == SETUP_PWM_UPTIME) { @@ -838,7 +838,7 @@ store_sf_ctrl(struct device *dev, struct device_attribute *attr, mutex_lock(&data->update_lock); if (nr == TEMP_FAN_MAP) { - val = SENSORS_LIMIT(val, 0, 255); + val = clamp_val(val, 0, 255); w83793_write_value(client, W83793_REG_TEMP_FAN_MAP(index), val); data->temp_fan_map[index] = val; } else if (nr == TEMP_PWM_ENABLE) { @@ -907,7 +907,7 @@ store_sf2_pwm(struct device *dev, struct device_attribute *attr, err = kstrtoul(buf, 10, &val); if (err) return err; - val = SENSORS_LIMIT(val, 0, 0xff) >> 2; + val = clamp_val(val, 0, 0xff) >> 2; mutex_lock(&data->update_lock); data->sf2_pwm[index][nr] = @@ -1003,9 +1003,9 @@ store_in(struct device *dev, struct device_attribute *attr, /* fix the limit values of 5VDD and 5VSB to ALARM mechanism */ if (nr == 1 || nr == 2) val -= scale_in_add[index] / scale_in[index]; - val = SENSORS_LIMIT(val, 0, 255); + val = clamp_val(val, 0, 255); } else { - val = SENSORS_LIMIT(val, 0, 0x3FF); + val = clamp_val(val, 0, 0x3FF); data->in_low_bits[nr] = w83793_read_value(client, W83793_REG_IN_LOW_BITS[nr]); data->in_low_bits[nr] &= ~(0x03 << (2 * index)); |