staging:iio:adxrs450: Perform sign extension for the calibbias register

The calibbias (DNC) register contains a 10-bit twos complement value. Perform a
proper sign extension when reading the register, otherwise negative will
incorrectly be displayed as large positive values.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Lars-Peter Clausen 2013-01-31 14:27:00 +00:00 коммит произвёл Jonathan Cameron
Родитель 1a87e4fba6
Коммит c62b89c713
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -326,7 +326,7 @@ static int adxrs450_read_raw(struct iio_dev *indio_dev,
ret = adxrs450_spi_read_reg_16(indio_dev, ADXRS450_DNC1, &t);
if (ret)
break;
*val = t;
*val = sign_extend32(t, 9);
ret = IIO_VAL_INT;
break;
default: