RE: [PATCH 1/1] iio: accel: bmc150: fix endianness when reading axes

From: Tirdea, Irina
Date: Tue Mar 29 2016 - 08:31:31 EST




> -----Original Message-----
> From: linux-iio-owner@xxxxxxxxxxxxxxx [mailto:linux-iio-owner@xxxxxxxxxxxxxxx] On Behalf Of Peter Meerwald-Stadler
> Sent: 28 March, 2016 20:43
> To: Tirdea, Irina
> Cc: Jonathan Cameron; linux-iio@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Hartmut Knaack; Lars-Peter Clausen; Markus
> Pargmann
> Subject: Re: [PATCH 1/1] iio: accel: bmc150: fix endianness when reading axes
>
> On Mon, 28 Mar 2016, Irina Tirdea wrote:
>
> > 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").
>
> looks good
>
> in bmc150_accel_get_axis() the call to regmap_bulk_read() could now pass
> sizeof(raw_val) instead of 2
>

Yes, that would look better. I'll send a new version with this change.

Thanks,
Irina