The device uses the MSB of the returned temperature value as an error flag. Return a read error when this bit is set. Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@xxxxxxxxxxxxx> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@xxxxxxx> --- v3: return -EIO instead of -EREMOTEIO v2: new patch --- drivers/iio/temperature/mlx90614.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c index 73ec767..06b7b96 100644 --- a/drivers/iio/temperature/mlx90614.c +++ b/drivers/iio/temperature/mlx90614.c @@ -196,6 +196,11 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev, if (ret < 0) return ret; + + /* MSB is an error flag */ + if (ret & 0x8000) + return -EIO; + *val = ret; return IIO_VAL_INT; case IIO_CHAN_INFO_OFFSET: -- 2.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html