aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hwmon.h11
-rw-r--r--include/linux/i2c-sensor.h12
2 files changed, 11 insertions, 12 deletions
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index bf90e6001e3b..0efd994c37f1 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -20,5 +20,16 @@ struct class_device *hwmon_device_register(struct device *dev);
20 20
21void hwmon_device_unregister(struct class_device *cdev); 21void hwmon_device_unregister(struct class_device *cdev);
22 22
23/* Scale user input to sensible values */
24static 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
23#endif 34#endif
24 35
diff --git a/include/linux/i2c-sensor.h b/include/linux/i2c-sensor.h
index ae73b9e789cb..e832d3286a46 100644
--- a/include/linux/i2c-sensor.h
+++ b/include/linux/i2c-sensor.h
@@ -242,16 +242,4 @@ extern int i2c_detect(struct i2c_adapter *adapter,
242 struct i2c_address_data *address_data, 242 struct i2c_address_data *address_data,
243 int (*found_proc) (struct i2c_adapter *, int, int)); 243 int (*found_proc) (struct i2c_adapter *, int, int));
244 244
245
246/* This macro is used to scale user-input to sensible values in almost all
247 chip drivers. */
248static inline int SENSORS_LIMIT(long value, long low, long high)
249{
250 if (value < low)
251 return low;
252 else if (value > high)
253 return high;
254 else
255 return value;
256}
257#endif /* def _LINUX_I2C_SENSOR_H */ 245#endif /* def _LINUX_I2C_SENSOR_H */