iio: gyro: bmg160: fix endianness when reading axes
authorIrina Tirdea <irina.tirdea@intel.com>
Tue, 29 Mar 2016 12:37:30 +0000 (15:37 +0300)
committerJonathan Cameron <jic23@kernel.org>
Sun, 3 Apr 2016 10:16:48 +0000 (11:16 +0100)
commit95e7ff034175db7d8aefabe7716c4d42bea24fde
tree4bb6b422a1d2a4ded420323d9e5fc1a262cbc601
parent2215f31dc6f88634c1916362e922b1ecdce0a6b3
iio: gyro: bmg160: fix endianness when reading axes

For big endian platforms, reading the axes will return
invalid values.

The device stores each axis value in a 16 bit little
endian register. The driver uses regmap_read_bulk to get
the axis value, resulting in a 16 bit little endian value.
This needs to be converted to cpu endianness to work
on big endian platforms.

Fix endianness for big endian platforms by converting
the values for the axes read from little endian to
cpu.

This is also partially fixed in commit 82d8e5da1a33 ("iio:
accel: bmg160: optimize transfers in trigger handler").

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/gyro/bmg160_core.c
This page took 0.024006 seconds and 5 git commands to generate.