diff options
author | Guenter Roeck <linux@roeck-us.net> | 2013-01-09 11:12:46 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2013-01-26 00:03:54 -0500 |
commit | c25fb816298138a4b12c606f0aaa018bdd3cc09c (patch) | |
tree | 5a81dfb83d2974412e7133bba23cf39c80677127 | |
parent | c73bad746cad97e438ccd148705907f20697288a (diff) |
hwmon: Retire SENSORS_LIMIT
SENSORS_LIMIT and clamp_val have the same functionality, so retire SENSORS_LIMIT
as it is no longer needed.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r-- | Documentation/hwmon/sysfs-interface | 8 | ||||
-rw-r--r-- | include/linux/hwmon.h | 12 |
2 files changed, 4 insertions, 16 deletions
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface index 1f4dd855a299..79f8257dd790 100644 --- a/Documentation/hwmon/sysfs-interface +++ b/Documentation/hwmon/sysfs-interface | |||
@@ -722,14 +722,14 @@ add/subtract if it has been divided before the add/subtract. | |||
722 | What to do if a value is found to be invalid, depends on the type of the | 722 | What to do if a value is found to be invalid, depends on the type of the |
723 | sysfs attribute that is being set. If it is a continuous setting like a | 723 | sysfs attribute that is being set. If it is a continuous setting like a |
724 | tempX_max or inX_max attribute, then the value should be clamped to its | 724 | tempX_max or inX_max attribute, then the value should be clamped to its |
725 | limits using SENSORS_LIMIT(value, min_limit, max_limit). If it is not | 725 | limits using clamp_val(value, min_limit, max_limit). If it is not continuous |
726 | continuous like for example a tempX_type, then when an invalid value is | 726 | like for example a tempX_type, then when an invalid value is written, |
727 | written, -EINVAL should be returned. | 727 | -EINVAL should be returned. |
728 | 728 | ||
729 | Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees): | 729 | Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees): |
730 | 730 | ||
731 | long v = simple_strtol(buf, NULL, 10) / 1000; | 731 | long v = simple_strtol(buf, NULL, 10) / 1000; |
732 | v = SENSORS_LIMIT(v, -128, 127); | 732 | v = clamp_val(v, -128, 127); |
733 | /* write v to register */ | 733 | /* write v to register */ |
734 | 734 | ||
735 | Example2, fan divider setting, valid values 2, 4 and 8: | 735 | Example2, fan divider setting, valid values 2, 4 and 8: |
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index 82b29ae6ebb0..b2514f70d591 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h | |||
@@ -20,16 +20,4 @@ struct device *hwmon_device_register(struct device *dev); | |||
20 | 20 | ||
21 | void hwmon_device_unregister(struct device *dev); | 21 | void hwmon_device_unregister(struct device *dev); |
22 | 22 | ||
23 | /* Scale user input to sensible values */ | ||
24 | static inline int SENSORS_LIMIT(long value, long low, long high) | ||
25 | { | ||
26 | if (value < low) | ||
27 | return low; | ||
28 | else if (value > high) | ||
29 | return high; | ||
30 | else | ||
31 | return value; | ||
32 | } | ||
33 | |||
34 | #endif | 23 | #endif |
35 | |||