patch "iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields" added to char-misc-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 3af0c1fb1cdc351b64ff1a4bc06d491490c1f10a Mon Sep 17 00:00:00 2001
From: Francesco Lavra <[email protected]>
Date: Fri, 17 Oct 2025 19:32:08 +0200
Subject: iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields
The decimator and batch fields of struct st_lsm6dsx_settings are arrays indexed by sensor type, not by sensor hardware identifier; moreover, the batch field is only used for the accelerometer and gyroscope.
Change the array size for decimator from ST_LSM6DSX_MAX_ID to ST_LSM6DSX_ID_MAX, and change the array size for batch from ST_LSM6DSX_MAX_ID to 2; move the enum st_lsm6dsx_sensor_id definition so that the ST_LSM6DSX_ID_MAX value is usable within the struct st_lsm6dsx_settings definition.
--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h +11 -11
@@ -252,6 +252,15 @@ struct st_lsm6dsx_event_settings {u8 wakeup_src_x_mask; }; +enum st_lsm6dsx_sensor_id { +ST_LSM6DSX_ID_GYRO , +ST_LSM6DSX_ID_ACC , +ST_LSM6DSX_ID_EXT0 , +ST_LSM6DSX_ID_EXT1 , +ST_LSM6DSX_ID_EXT2 , +ST_LSM6DSX_ID_MAX +}; +enum st_lsm6dsx_ext_sensor_id {ST_LSM6DSX_ID_MAGN , };
@@ -337,23 +346,14 @@ struct st_lsm6dsx_settings {struct st_lsm6dsx_odr_table_entry odr_table[2 ];struct st_lsm6dsx_samples_to_discard samples_to_discard[2 ];struct st_lsm6dsx_fs_table_entry fs_table[2 ]; -struct st_lsm6dsx_reg decimator[ST_LSM6DSX_MAX_ID ]; -struct st_lsm6dsx_reg batch[ST_LSM6DSX_MAX_ID ]; +struct st_lsm6dsx_reg decimator[ST_LSM6DSX_ID_MAX ]; +struct st_lsm6dsx_reg batch[2 ];struct st_lsm6dsx_fifo_ops fifo_ops;struct st_lsm6dsx_hw_ts_settings ts_settings;struct st_lsm6dsx_shub_settings shub_settings;struct st_lsm6dsx_event_settings event_settings; }; -enum st_lsm6dsx_sensor_id { -ST_LSM6DSX_ID_GYRO , -ST_LSM6DSX_ID_ACC , -ST_LSM6DSX_ID_EXT0 , -ST_LSM6DSX_ID_EXT1 , -ST_LSM6DSX_ID_EXT2 , -ST_LSM6DSX_ID_MAX , -}; -enum st_lsm6dsx_fifo_mode {ST_LSM6DSX_FIFO_BYPASS =0x0 ,ST_LSM6DSX_FIFO_CONT =0x6 ,
Signature · 1 line
2.51.2