iio: inkern: fix iio_convert_raw_to_processed_unlocked
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>
Mon, 1 Jul 2013 16:40:00 +0000 (17:40 +0100)
committerJonathan Cameron <jic23@kernel.org>
Wed, 3 Jul 2013 19:30:52 +0000 (20:30 +0100)
commitf91d1b63a4e096d3023aaaafec9d9d3aff25997f
tree03339141691dfb4a10a99c992f6484eb46772692
parent1c297a66654a3295ae87e2b7f3724d214eb2b5ec
iio: inkern: fix iio_convert_raw_to_processed_unlocked

When reading IIO_CHAN_INFO_OFFSET, the return value of iio_channel_read() for
success will be IIO_VAL*, checking for 0 is not correct.

Without this fix the offset applied by iio drivers will be ignored when
converting a raw value to one in appropriate base units (e.g mV) in
a IIO client drivers that use iio_convert_raw_to_processed including
iio-hwmon.

Cc: <stable@vger.kernel.org> # 3.10.x
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/inkern.c