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 <lars.povlsen@microchip.com> Link: https://lore.kernel.org/r/20200903134704.8949-1-lars.povlsen@microchip.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Родитель
ba4f184e12
Коммит
fcb575bfac
|
@ -56,7 +56,7 @@ static int s5_read(struct device *dev, enum hwmon_sensor_types type,
|
||||||
case hwmon_temp_input:
|
case hwmon_temp_input:
|
||||||
stat = readl_relaxed(hwmon->base + TEMP_STAT);
|
stat = readl_relaxed(hwmon->base + TEMP_STAT);
|
||||||
if (!(stat & TEMP_STAT_VALID))
|
if (!(stat & TEMP_STAT_VALID))
|
||||||
return -EIO;
|
return -EAGAIN;
|
||||||
value = stat & TEMP_STAT_TEMP;
|
value = stat & TEMP_STAT_TEMP;
|
||||||
/*
|
/*
|
||||||
* From register documentation:
|
* From register documentation:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче