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/adt7470.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/adt7470.c')
-rw-r--r-- | drivers/hwmon/adt7470.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index 39ecb1a3b9ef..b83bf4bb95eb 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c | |||
@@ -452,7 +452,7 @@ static ssize_t set_auto_update_interval(struct device *dev, | |||
452 | if (kstrtol(buf, 10, &temp)) | 452 | if (kstrtol(buf, 10, &temp)) |
453 | return -EINVAL; | 453 | return -EINVAL; |
454 | 454 | ||
455 | temp = SENSORS_LIMIT(temp, 0, 60000); | 455 | temp = clamp_val(temp, 0, 60000); |
456 | 456 | ||
457 | mutex_lock(&data->lock); | 457 | mutex_lock(&data->lock); |
458 | data->auto_update_interval = temp; | 458 | data->auto_update_interval = temp; |
@@ -481,7 +481,7 @@ static ssize_t set_num_temp_sensors(struct device *dev, | |||
481 | if (kstrtol(buf, 10, &temp)) | 481 | if (kstrtol(buf, 10, &temp)) |
482 | return -EINVAL; | 482 | return -EINVAL; |
483 | 483 | ||
484 | temp = SENSORS_LIMIT(temp, -1, 10); | 484 | temp = clamp_val(temp, -1, 10); |
485 | 485 | ||
486 | mutex_lock(&data->lock); | 486 | mutex_lock(&data->lock); |
487 | data->num_temp_sensors = temp; | 487 | data->num_temp_sensors = temp; |
@@ -515,7 +515,7 @@ static ssize_t set_temp_min(struct device *dev, | |||
515 | return -EINVAL; | 515 | return -EINVAL; |
516 | 516 | ||
517 | temp = DIV_ROUND_CLOSEST(temp, 1000); | 517 | temp = DIV_ROUND_CLOSEST(temp, 1000); |
518 | temp = SENSORS_LIMIT(temp, 0, 255); | 518 | temp = clamp_val(temp, 0, 255); |
519 | 519 | ||
520 | mutex_lock(&data->lock); | 520 | mutex_lock(&data->lock); |
521 | data->temp_min[attr->index] = temp; | 521 | data->temp_min[attr->index] = temp; |
@@ -549,7 +549,7 @@ static ssize_t set_temp_max(struct device *dev, | |||
549 | return -EINVAL; | 549 | return -EINVAL; |
550 | 550 | ||
551 | temp = DIV_ROUND_CLOSEST(temp, 1000); | 551 | temp = DIV_ROUND_CLOSEST(temp, 1000); |
552 | temp = SENSORS_LIMIT(temp, 0, 255); | 552 | temp = clamp_val(temp, 0, 255); |
553 | 553 | ||
554 | mutex_lock(&data->lock); | 554 | mutex_lock(&data->lock); |
555 | data->temp_max[attr->index] = temp; | 555 | data->temp_max[attr->index] = temp; |
@@ -604,7 +604,7 @@ static ssize_t set_fan_max(struct device *dev, | |||
604 | return -EINVAL; | 604 | return -EINVAL; |
605 | 605 | ||
606 | temp = FAN_RPM_TO_PERIOD(temp); | 606 | temp = FAN_RPM_TO_PERIOD(temp); |
607 | temp = SENSORS_LIMIT(temp, 1, 65534); | 607 | temp = clamp_val(temp, 1, 65534); |
608 | 608 | ||
609 | mutex_lock(&data->lock); | 609 | mutex_lock(&data->lock); |
610 | data->fan_max[attr->index] = temp; | 610 | data->fan_max[attr->index] = temp; |
@@ -641,7 +641,7 @@ static ssize_t set_fan_min(struct device *dev, | |||
641 | return -EINVAL; | 641 | return -EINVAL; |
642 | 642 | ||
643 | temp = FAN_RPM_TO_PERIOD(temp); | 643 | temp = FAN_RPM_TO_PERIOD(temp); |
644 | temp = SENSORS_LIMIT(temp, 1, 65534); | 644 | temp = clamp_val(temp, 1, 65534); |
645 | 645 | ||
646 | mutex_lock(&data->lock); | 646 | mutex_lock(&data->lock); |
647 | data->fan_min[attr->index] = temp; | 647 | data->fan_min[attr->index] = temp; |
@@ -717,7 +717,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, | |||
717 | if (kstrtol(buf, 10, &temp)) | 717 | if (kstrtol(buf, 10, &temp)) |
718 | return -EINVAL; | 718 | return -EINVAL; |
719 | 719 | ||
720 | temp = SENSORS_LIMIT(temp, 0, 255); | 720 | temp = clamp_val(temp, 0, 255); |
721 | 721 | ||
722 | mutex_lock(&data->lock); | 722 | mutex_lock(&data->lock); |
723 | data->pwm[attr->index] = temp; | 723 | data->pwm[attr->index] = temp; |
@@ -749,7 +749,7 @@ static ssize_t set_pwm_max(struct device *dev, | |||
749 | if (kstrtol(buf, 10, &temp)) | 749 | if (kstrtol(buf, 10, &temp)) |
750 | return -EINVAL; | 750 | return -EINVAL; |
751 | 751 | ||
752 | temp = SENSORS_LIMIT(temp, 0, 255); | 752 | temp = clamp_val(temp, 0, 255); |
753 | 753 | ||
754 | mutex_lock(&data->lock); | 754 | mutex_lock(&data->lock); |
755 | data->pwm_max[attr->index] = temp; | 755 | data->pwm_max[attr->index] = temp; |
@@ -782,7 +782,7 @@ static ssize_t set_pwm_min(struct device *dev, | |||
782 | if (kstrtol(buf, 10, &temp)) | 782 | if (kstrtol(buf, 10, &temp)) |
783 | return -EINVAL; | 783 | return -EINVAL; |
784 | 784 | ||
785 | temp = SENSORS_LIMIT(temp, 0, 255); | 785 | temp = clamp_val(temp, 0, 255); |
786 | 786 | ||
787 | mutex_lock(&data->lock); | 787 | mutex_lock(&data->lock); |
788 | data->pwm_min[attr->index] = temp; | 788 | data->pwm_min[attr->index] = temp; |
@@ -826,7 +826,7 @@ static ssize_t set_pwm_tmin(struct device *dev, | |||
826 | return -EINVAL; | 826 | return -EINVAL; |
827 | 827 | ||
828 | temp = DIV_ROUND_CLOSEST(temp, 1000); | 828 | temp = DIV_ROUND_CLOSEST(temp, 1000); |
829 | temp = SENSORS_LIMIT(temp, 0, 255); | 829 | temp = clamp_val(temp, 0, 255); |
830 | 830 | ||
831 | mutex_lock(&data->lock); | 831 | mutex_lock(&data->lock); |
832 | data->pwm_tmin[attr->index] = temp; | 832 | data->pwm_tmin[attr->index] = temp; |