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/f75375s.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/f75375s.c')
-rw-r--r-- | drivers/hwmon/f75375s.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index f7dba229395f..9e300e567f15 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
@@ -359,7 +359,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, | |||
359 | return -EINVAL; | 359 | return -EINVAL; |
360 | 360 | ||
361 | mutex_lock(&data->update_lock); | 361 | mutex_lock(&data->update_lock); |
362 | data->pwm[nr] = SENSORS_LIMIT(val, 0, 255); | 362 | data->pwm[nr] = clamp_val(val, 0, 255); |
363 | f75375_write_pwm(client, nr); | 363 | f75375_write_pwm(client, nr); |
364 | mutex_unlock(&data->update_lock); | 364 | mutex_unlock(&data->update_lock); |
365 | return count; | 365 | return count; |
@@ -556,7 +556,7 @@ static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, | |||
556 | if (err < 0) | 556 | if (err < 0) |
557 | return err; | 557 | return err; |
558 | 558 | ||
559 | val = SENSORS_LIMIT(VOLT_TO_REG(val), 0, 0xff); | 559 | val = clamp_val(VOLT_TO_REG(val), 0, 0xff); |
560 | mutex_lock(&data->update_lock); | 560 | mutex_lock(&data->update_lock); |
561 | data->in_max[nr] = val; | 561 | data->in_max[nr] = val; |
562 | f75375_write8(client, F75375_REG_VOLT_HIGH(nr), data->in_max[nr]); | 562 | f75375_write8(client, F75375_REG_VOLT_HIGH(nr), data->in_max[nr]); |
@@ -577,7 +577,7 @@ static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, | |||
577 | if (err < 0) | 577 | if (err < 0) |
578 | return err; | 578 | return err; |
579 | 579 | ||
580 | val = SENSORS_LIMIT(VOLT_TO_REG(val), 0, 0xff); | 580 | val = clamp_val(VOLT_TO_REG(val), 0, 0xff); |
581 | mutex_lock(&data->update_lock); | 581 | mutex_lock(&data->update_lock); |
582 | data->in_min[nr] = val; | 582 | data->in_min[nr] = val; |
583 | f75375_write8(client, F75375_REG_VOLT_LOW(nr), data->in_min[nr]); | 583 | f75375_write8(client, F75375_REG_VOLT_LOW(nr), data->in_min[nr]); |
@@ -625,7 +625,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, | |||
625 | if (err < 0) | 625 | if (err < 0) |
626 | return err; | 626 | return err; |
627 | 627 | ||
628 | val = SENSORS_LIMIT(TEMP_TO_REG(val), 0, 127); | 628 | val = clamp_val(TEMP_TO_REG(val), 0, 127); |
629 | mutex_lock(&data->update_lock); | 629 | mutex_lock(&data->update_lock); |
630 | data->temp_high[nr] = val; | 630 | data->temp_high[nr] = val; |
631 | f75375_write8(client, F75375_REG_TEMP_HIGH(nr), data->temp_high[nr]); | 631 | f75375_write8(client, F75375_REG_TEMP_HIGH(nr), data->temp_high[nr]); |
@@ -646,7 +646,7 @@ static ssize_t set_temp_max_hyst(struct device *dev, | |||
646 | if (err < 0) | 646 | if (err < 0) |
647 | return err; | 647 | return err; |
648 | 648 | ||
649 | val = SENSORS_LIMIT(TEMP_TO_REG(val), 0, 127); | 649 | val = clamp_val(TEMP_TO_REG(val), 0, 127); |
650 | mutex_lock(&data->update_lock); | 650 | mutex_lock(&data->update_lock); |
651 | data->temp_max_hyst[nr] = val; | 651 | data->temp_max_hyst[nr] = val; |
652 | f75375_write8(client, F75375_REG_TEMP_HYST(nr), | 652 | f75375_write8(client, F75375_REG_TEMP_HYST(nr), |
@@ -822,7 +822,7 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data, | |||
822 | if (auto_mode_enabled(f75375s_pdata->pwm_enable[nr]) || | 822 | if (auto_mode_enabled(f75375s_pdata->pwm_enable[nr]) || |
823 | !duty_mode_enabled(f75375s_pdata->pwm_enable[nr])) | 823 | !duty_mode_enabled(f75375s_pdata->pwm_enable[nr])) |
824 | continue; | 824 | continue; |
825 | data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255); | 825 | data->pwm[nr] = clamp_val(f75375s_pdata->pwm[nr], 0, 255); |
826 | f75375_write_pwm(client, nr); | 826 | f75375_write_pwm(client, nr); |
827 | } | 827 | } |
828 | 828 | ||