lkml.org 
[lkml]   [2018]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL for 4.15 066/124] iio: imu: st_lsm6dsx: fix endianness in st_lsm6dsx_read_oneshot()
    Date
    From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

    [ Upstream commit 7b9ebe428266fb7e0a6d769bb3ff3fcb6044b15e ]

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

    Fixes: 290a6ce11d93 (iio: imu: add support to lsm6dsx driver)
    Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    ---
    drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
    index 239c735242be..812cd25f284e 100644
    --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
    +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
    @@ -448,7 +448,7 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor,

    st_lsm6dsx_sensor_disable(sensor);

    - *val = (s16)data;
    + *val = (s16)le16_to_cpu(data);

    return IIO_VAL_INT;
    }
    --
    2.14.1
    \
     
     \ /
      Last update: 2018-03-19 23:27    [W:4.074 / U:0.328 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site