Commit 7b9ebe42 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Greg Kroah-Hartman

iio: imu: st_lsm6dsx: fix endianness in st_lsm6dsx_read_oneshot()

Apply le16_to_cpu() to data read from the sensor in order to take into
account architecture endianness

Fixes: 290a6ce1 (iio: imu: add support to lsm6dsx driver)
Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e1ca1141
...@@ -448,7 +448,7 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor, ...@@ -448,7 +448,7 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor,
st_lsm6dsx_sensor_disable(sensor); st_lsm6dsx_sensor_disable(sensor);
*val = (s16)data; *val = (s16)le16_to_cpu(data);
return IIO_VAL_INT; return IIO_VAL_INT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment