summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorAndrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>2021-06-23 15:07:27 +0000
committerAndrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>2021-06-23 15:07:27 +0000
commitdb8ff65069a384326486a94ec13716a833fbe6fd (patch)
tree059ff631ea9ffa58a167d94b76588cace2255db8 /drivers/hwmon
parent4efcf5cb62af1dae546bc1022b4edf6dedb6c983 (diff)
parent4037804c55745738e0950658a5132790e6ac52e4 (diff)
Merge tag 'v5.4.128' into 5.4-2.3.x-imx
This is the 5.4.128 stable release Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/scpi-hwmon.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
index 25aac40f2764..919877970ae3 100644
--- a/drivers/hwmon/scpi-hwmon.c
+++ b/drivers/hwmon/scpi-hwmon.c
@@ -99,6 +99,15 @@ scpi_show_sensor(struct device *dev, struct device_attribute *attr, char *buf)
scpi_scale_reading(&value, sensor);
+ /*
+ * Temperature sensor values are treated as signed values based on
+ * observation even though that is not explicitly specified, and
+ * because an unsigned u64 temperature does not really make practical
+ * sense especially when the temperature is below zero degrees Celsius.
+ */
+ if (sensor->info.class == TEMPERATURE)
+ return sprintf(buf, "%lld\n", (s64)value);
+
return sprintf(buf, "%llu\n", value);
}