mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
iio: orientation: hid-sensor-rotation: fix quaternion alignment
Restore the alignment of sampled_vals to 16 bytes by using
IIO_DECLARE_QUATERNION(). This field contains a quaternion value which
has scan_type.repeat = 4 and storagebits = 32. So the alignment must
be 16 bytes to match the assumptions of iio_storage_bytes_for_si() and
also to not break userspace.
Reported-by: Lixu Zhang <lixu.zhang@intel.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221077
Fixes: b31a74075c ("iio: orientation: hid-sensor-rotation: remove unnecessary alignment")
Tested-by: Lixu Zhang <lixu.zhang@intel.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
56bd57e7b1
commit
50d4cc74b8
@@ -19,7 +19,7 @@ struct dev_rot_state {
|
||||
struct hid_sensor_common common_attributes;
|
||||
struct hid_sensor_hub_attribute_info quaternion;
|
||||
struct {
|
||||
s32 sampled_vals[4];
|
||||
IIO_DECLARE_QUATERNION(s32, sampled_vals);
|
||||
aligned_s64 timestamp;
|
||||
} scan;
|
||||
int scale_pre_decml;
|
||||
|
||||
Reference in New Issue
Block a user