Re: [PATCH] iio: imu: bno055: add explicit scan buf layout
From: Andy Shevchenko
Date: Mon Feb 16 2026 - 02:49:36 EST
On Sat, Feb 14, 2026 at 04:10:38PM -0600, David Lechner wrote:
> Move the scan buf.chans array into a union along with a struct that
> gives the layout of the buffer with all channels enabled.
>
> Although not technically required in this case, if there had been a
> different number of items before the quaternion, there could have been
> a subtle bug with the special alignment needed for the quaternion
> channel data and the array would have been too small.
...
> + struct {
> + __le16 acc[3];
> + __le16 magn[3];
> + __le16 gyr[3];
> + __le16 yaw;
> + __le16 pitch;
> + __le16 roll;
> + IIO_DECLARE_REPEATED_ELEMENT(__le16, quaternion, 4);
Right, and like I suggested:
IIO_DECLARE_QUATERNION(__le16, quaternion);
> + __le16 lia[3];
> + __le16 gravity[3];
> + };
--
With Best Regards,
Andy Shevchenko