aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Povlsen <[email protected]>2020-09-03 15:47:04 +0200
committerGuenter Roeck <[email protected]>2020-09-23 09:39:40 -0700
commitfcb575bfac80d6deb4940d2ebf506d6701761f38 (patch)
tree5efe7f1c4dc6913b3a05abe3c5d45a0760fceeeb
parentba4f184e126b751d1bffad5897f263108befc780 (diff)
hwmon: (sparx5) Fix initial reading of temperature
If the temperature is read before the internal calibration is completed, the driver returns -EIO. Instead it should return -EAGAIN to encourage repeating the operation. Note (groeck): Returning -EAGAIN to userspace may result in hard loops; some userspace code interprets -EAGAIN as request to retry immediately. I would prefer -ENODATA, but it turns out that the thermal subsystem only handles -EAGAIN silently, so we'll have to stick with that. Signed-off-by: Lars Povlsen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
-rw-r--r--drivers/hwmon/sparx5-temp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/sparx5-temp.c b/drivers/hwmon/sparx5-temp.c
index 1a2b1026b026..98be48e3a22a 100644
--- a/drivers/hwmon/sparx5-temp.c
+++ b/drivers/hwmon/sparx5-temp.c
@@ -56,7 +56,7 @@ static int s5_read(struct device *dev, enum hwmon_sensor_types type,
case hwmon_temp_input:
stat = readl_relaxed(hwmon->base + TEMP_STAT);
if (!(stat & TEMP_STAT_VALID))
- return -EIO;
+ return -EAGAIN;
value = stat & TEMP_STAT_TEMP;
/*
* From register documentation: