Skip to content

iio: orientation: hid-sensor-rotation: fix quaternion alignment

David Lechner linux-iio linux-input lkml 2 versions – In review

Get series with b4
b4 am [email protected] change-id 20260214-iio-fix-repeat-alignment-575b2c009e25

Versions newest first

  1. v2 Latest2 patches 8 repliesIn review
  2. v12 patches 6 repliesSuperseded

Changes in v2 from the cover letter

- Rename IIO_DECLARE_REPEATED_ELEMENT() to IIO_DECLARE_QUATERNION().
- Link to v1: https://lore.kernel.org/r/[email protected]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2iio: add IIO_DECLARE_QUATERNION() macroinclude/linux/iio/iio.h+12 -04 replies
2/2iio: orientation: hid-sensor-rotation: fix quaternion alignmentdrivers/iio/orientation/hid-sensor-rotation.c+1 -10 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchLixu ZhangAndy Shevchenko
SeriesR-b
1/2
2/2T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] iio: orientation: hid-sensor-rotation: fix quaternion alignment

The main point of this series is to fix a regression reported in hid-sensor-rotation where the alignment of the quaternion field in the data was inadvertently changed from 16 bytes to 8 bytes. This is an unusually case (one of only 2 in the kernel) where the .repeat field of struct iio_scan_type is used and we have such a requirement. (The other case uses u16 instead of u32, so it wasn't affected.)

To make the reason for the alignment more explicit to future readers, we introduce a new macro, IIO_DECLARE_QUATERNION(), to declare the array with proper alignment. This is meant to follow the pattern of the similar IIO_DECLARE_BUFFER_WITH_TS() macro.

---
Changes in v2:
- Rename IIO_DECLARE_REPEATED_ELEMENT() to IIO_DECLARE_QUATERNION().
- Link to v1: https://lore.kernel.org/r/[email protected]

---
David Lechner (2):
iio: add IIO_DECLARE_QUATERNION() macro
iio: orientation: hid-sensor-rotation: fix quaternion alignment

 drivers/iio/orientation/hid-sensor-rotation.c |  2 +-
 include/linux/iio/iio.h                       | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

---
base-commit: 3fa5e5702a82d259897bd7e209469bc06368bf31
change-id: 20260214-iio-fix-repeat-alignment-575b2c009e25

Best regards,

Signature · 1 line
David Lechner <[email protected]>