]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
iio: accel: bmc150: fix endianness when reading axes
authorIrina Tirdea <irina.tirdea@intel.com>
Tue, 29 Mar 2016 12:35:45 +0000 (15:35 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Apr 2016 06:42:12 +0000 (15:42 +0900)
commit82bd14ade909c156f297ad34f0e6935931c6149f
treeeb585913f497e2965b18be37ee6ed91f7472aa78
parent01e647a4aec55a156efccdf542579830fd1516eb
iio: accel: bmc150: fix endianness when reading axes

commit 2215f31dc6f88634c1916362e922b1ecdce0a6b3 upstream.

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 b6fb9b6d6552 ("iio:
accel: bmc150: optimize transfers in trigger handler").

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/accel/bmc150-accel-core.c