diff mbox series

[1/2] iio: accel: fxls8962af: fixup buffer scan element type

Message ID 20230605103223.1400980-1-sean@geanix.com (mailing list archive)
State Accepted
Headers show
Series [1/2] iio: accel: fxls8962af: fixup buffer scan element type | expand

Commit Message

Sean Nyekjaer June 5, 2023, 10:32 a.m. UTC
Scan elements for x,y,z channels is little endian and requires no bit shifts.
LE vs. BE is controlled in register SENS_CONFIG2 and bit LE_BE, default
value is LE.

Fixes: a3e0b51884ee ("iio: accel: add support for FXLS8962AF/FXLS8964AF accelerometers")
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Cc: stable@vger.kernel.org
---
 drivers/iio/accel/fxls8962af-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jonathan Cameron June 5, 2023, 7:04 p.m. UTC | #1
On Mon,  5 Jun 2023 12:32:21 +0200
Sean Nyekjaer <sean@geanix.com> wrote:

> Scan elements for x,y,z channels is little endian and requires no bit shifts.
> LE vs. BE is controlled in register SENS_CONFIG2 and bit LE_BE, default
> value is LE.
> 
> Fixes: a3e0b51884ee ("iio: accel: add support for FXLS8962AF/FXLS8964AF accelerometers")
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> Cc: stable@vger.kernel.org

Hmm. I'm not going to ask how this didn't come up in testing before now...

> ---
>  drivers/iio/accel/fxls8962af-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
> index 0d672b1469e8..bf7949e51e6c 100644
> --- a/drivers/iio/accel/fxls8962af-core.c
> +++ b/drivers/iio/accel/fxls8962af-core.c
> @@ -724,8 +724,8 @@ static const struct iio_event_spec fxls8962af_event[] = {
>  		.sign = 's', \
>  		.realbits = 12, \
>  		.storagebits = 16, \
> -		.shift = 4, \
> -		.endianness = IIO_BE, \
> +		.shift = 0, \

We'd normally not explicitly specify shift = 0 as that's both the obvious default and
what C will give us for free.

I'll tidy that up whilst applying.

Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> +		.endianness = IIO_LE, \
>  	}, \
>  	.event_spec = fxls8962af_event, \
>  	.num_event_specs = ARRAY_SIZE(fxls8962af_event), \
diff mbox series

Patch

diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
index 0d672b1469e8..bf7949e51e6c 100644
--- a/drivers/iio/accel/fxls8962af-core.c
+++ b/drivers/iio/accel/fxls8962af-core.c
@@ -724,8 +724,8 @@  static const struct iio_event_spec fxls8962af_event[] = {
 		.sign = 's', \
 		.realbits = 12, \
 		.storagebits = 16, \
-		.shift = 4, \
-		.endianness = IIO_BE, \
+		.shift = 0, \
+		.endianness = IIO_LE, \
 	}, \
 	.event_spec = fxls8962af_event, \
 	.num_event_specs = ARRAY_SIZE(fxls8962af_event), \