Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457500 > unrolled thread

[PATCH 6/6] hwmon: (lm95241) Use more accurate limits

Started byGuenter Roeck <linux@roeck-us.net>
First post2016-08-08 01:40 +0200
Last post2016-08-08 01:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 6/6] hwmon: (lm95241) Use more accurate limits Guenter Roeck <linux@roeck-us.net> - 2016-08-08 01:40 +0200

#1457500 — [PATCH 6/6] hwmon: (lm95241) Use more accurate limits

FromGuenter Roeck <linux@roeck-us.net>
Date2016-08-08 01:40 +0200
Subject[PATCH 6/6] hwmon: (lm95241) Use more accurate limits
Message-ID<s3FPI-1Xa-5@gated-at.bofh.it>
The lower temperature limit is -128 degrees C. The supported upper limits
are 127.875 or 255.875 degrees C. Also, don't fail if a value outside
the supported range is provided when setting a temperature limit.
Instead, clamp the provided value to the available value range.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/lm95241.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c
index df94f486b21c..3d96c3fcba9b 100644
--- a/drivers/hwmon/lm95241.c
+++ b/drivers/hwmon/lm95241.c
@@ -205,7 +205,7 @@ static ssize_t show_min(struct device *dev, struct device_attribute *attr,
 
 	return snprintf(buf, PAGE_SIZE - 1,
 			data->config & to_sensor_dev_attr(attr)->index ?
-			"-127000\n" : "0\n");
+			"-128000\n" : "0\n");
 }
 
 static ssize_t set_min(struct device *dev, struct device_attribute *attr,
@@ -216,8 +216,6 @@ static ssize_t set_min(struct device *dev, struct device_attribute *attr,
 
 	if (kstrtol(buf, 10, &val) < 0)
 		return -EINVAL;
-	if (val < -128000)
-		return -EINVAL;
 
 	mutex_lock(&data->update_lock);
 
@@ -242,7 +240,7 @@ static ssize_t show_max(struct device *dev, struct device_attribute *attr,
 
 	return snprintf(buf, PAGE_SIZE - 1,
 			data->config & to_sensor_dev_attr(attr)->index ?
-			"127000\n" : "255000\n");
+			"127875\n" : "255875\n");
 }
 
 static ssize_t set_max(struct device *dev, struct device_attribute *attr,
@@ -253,8 +251,6 @@ static ssize_t set_max(struct device *dev, struct device_attribute *attr,
 
 	if (kstrtol(buf, 10, &val) < 0)
 		return -EINVAL;
-	if (val >= 256000)
-		return -EINVAL;
 
 	mutex_lock(&data->update_lock);
 
-- 
2.5.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web