Re: [PATCH v3 5/5] iio: mlx90614: Check for errors in read values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30/03/15 09:35, Vianney le Clément de Saint-Marcq wrote:
> 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>
Applied.
> 
> ---
> 
> 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:
> 

--
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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux