iio: accel: mma9553: fix endianness issue when reading status
authorIrina Tirdea <irina.tirdea@intel.com>
Mon, 13 Apr 2015 15:40:48 +0000 (18:40 +0300)
committerJonathan Cameron <jic23@kernel.org>
Sun, 26 Apr 2015 18:39:42 +0000 (19:39 +0100)
commitcd62322a9767f9a0bcf855123c478187e38a10f4
tree436f350ed4fa9d57fa42a1320234b0c47875058b
parent8e71c04f863a1754f21b27fb8ecb773d680a0a80
iio: accel: mma9553: fix endianness issue when reading status

Refactor code for simplicity and clarity.

This also fixes an endianness issue with the original code.
When reading multiple registers, the received buffer of
16-bytes words is little endian (status, step count). On
big endian machines, casting them to u32 would result in
reversed order in the buffer (step count, status) leading
to incorrect values for step count and activity.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reported-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/accel/mma9553.c