All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] iio: imu: st_lsm6dsx: fix endianness in st_lsm6dsx_read_oneshot()
@ 2018-01-01 18:54 Lorenzo Bianconi
  2018-01-06 12:18 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Bianconi @ 2018-01-01 18:54 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio

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>
---
 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.15.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/3] iio: imu: st_lsm6dsx: fix endianness in st_lsm6dsx_read_oneshot()
  2018-01-01 18:54 [PATCH 1/3] iio: imu: st_lsm6dsx: fix endianness in st_lsm6dsx_read_oneshot() Lorenzo Bianconi
@ 2018-01-06 12:18 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2018-01-06 12:18 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: linux-iio

On Mon,  1 Jan 2018 19:54:42 +0100
Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:

> 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>
I'm going to take this via togreg rather than the fixes branch
purely because we are very late in the cycle so that is probably
quicker now!

Applied to the togreg branch of iio.git and pushed out as testing.

Thanks,

Jonathan

> ---
>  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;
>  }


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-06 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-01 18:54 [PATCH 1/3] iio: imu: st_lsm6dsx: fix endianness in st_lsm6dsx_read_oneshot() Lorenzo Bianconi
2018-01-06 12:18 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.