diff options
author | Oliver Lang <Oliver.Lang@gossenmetrawatt.com> | 2021-06-10 16:46:18 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-20 17:17:30 +0300 |
commit | dc5e47b9227f15f3d973e4e822d6156aef294001 (patch) | |
tree | 2dc18fbc8c2fcb7458660052b5fed4cd926d68a6 /drivers/iio/light/ltr501.c | |
parent | 51c1ab060fd08f8109a0ed7602e6328d2470aadb (diff) | |
download | linux-dc5e47b9227f15f3d973e4e822d6156aef294001.tar.xz |
iio: ltr501: ltr501_read_ps(): add missing endianness conversion
commit 71b33f6f93ef9462c84560e2236ed22209d26a58 upstream.
The PS ADC Channel data is spread over 2 registers in little-endian
form. This patch adds the missing endianness conversion.
Fixes: 2690be905123 ("iio: Add Lite-On ltr501 ambient light / proximity sensor driver")
Signed-off-by: Oliver Lang <Oliver.Lang@gossenmetrawatt.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Nikita Travkin <nikita@trvn.ru> # ltr559
Link: https://lore.kernel.org/r/20210610134619.2101372-4-mkl@pengutronix.de
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/light/ltr501.c')
-rw-r--r-- | drivers/iio/light/ltr501.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index 0ab9bca229db..3d75e155bd3e 100644 --- a/drivers/iio/light/ltr501.c +++ b/drivers/iio/light/ltr501.c @@ -411,18 +411,19 @@ static int ltr501_read_als(struct ltr501_data *data, __le16 buf[2]) static int ltr501_read_ps(struct ltr501_data *data) { - int ret, status; + __le16 status; + int ret; ret = ltr501_drdy(data, LTR501_STATUS_PS_RDY); if (ret < 0) return ret; ret = regmap_bulk_read(data->regmap, LTR501_PS_DATA, - &status, 2); + &status, sizeof(status)); if (ret < 0) return ret; - return status; + return le16_to_cpu(status); } static int ltr501_read_intr_prst(struct ltr501_data *data, |