Re: [PATCH v9 1/6] iio: imu: st_lsm6dsx: Fix check for invalid samples from FIFO
From: Andy Shevchenko
Date: Tue Mar 24 2026 - 08:23:18 EST
On Tue, Mar 24, 2026 at 09:47:33AM +0100, Francesco Lavra wrote:
> The DRDY_MASK feature implemented in sensor chips marks gyroscope and
> accelerometer invalid samples (i.e. samples that have been acquired during
> the settling time of sensor filters) with the special values 0x7FFFh,
> 0x7FFE, and 0x7FFD.
> The driver checks FIFO samples against these special values in order to
> discard invalid samples; however, it does the check regardless of the type
> of samples being processed, whereas this feature is specific to gyroscope
> and accelerometer data. This could cause valid samples to be discarded.
>
> Fix the above check so that it takes into account the type of samples being
> processed. To avoid casting to __le16 * when checking sample values, clean
> up the type representation for data read from the FIFO.
...
> static int
> st_lsm6dsx_push_tagged_data(struct st_lsm6dsx_hw *hw, u8 tag,
> - u8 *data, s64 ts)
> + __le16 *data, s64 ts)
Dunno why this indentation, but if you need to send a new version, consider
static int st_lsm6dsx_push_tagged_data(struct st_lsm6dsx_hw *hw, u8 tag,
__le16 *data, s64 ts)
OR
static int
st_lsm6dsx_push_tagged_data(struct st_lsm6dsx_hw *hw, u8 tag, __le16 *data, s64 ts)
(yes, the second one goes to 83 characters).
--
With Best Regards,
Andy Shevchenko