[PATCH linux dev-4.10 2/2] drivers/iio: dps310 Use previous value if new reading not available yet

Christopher Bostic cbostic at linux.vnet.ibm.com
Tue Jul 25 07:25:09 AEST 2017


In cases where temperature is queried before the latest value is finished
reading then use the previously measured value instead of returning error.

Signed-off-by: Christopher Bostic <cbostic at linux.vnet.ibm.com>
---
 drivers/iio/pressure/dps310.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/pressure/dps310.c b/drivers/iio/pressure/dps310.c
index f351c26..c7ee99e 100644
--- a/drivers/iio/pressure/dps310.c
+++ b/drivers/iio/pressure/dps310.c
@@ -202,8 +202,8 @@ static int dps310_read_temp(struct dps310_data *data)
 	if (r < 0)
 		return r;
 	if (!(ready & DPS310_TMP_RDY)) {
-		dev_dbg(dev, "temperature not ready\n");
-		return -EAGAIN;
+		dev_dbg(dev, "temperature not ready, use last temp value\n");
+		return 0;
 	}
 
 	r = regmap_bulk_read(regmap, DPS310_TMP_BASE, val, 3);
-- 
1.8.2.2



More information about the openbmc mailing list