* [PATCH] iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields
@ 2025-10-17 17:32 Francesco Lavra
2025-10-18 9:33 ` Lorenzo Bianconi
2025-10-18 17:30 ` Andy Shevchenko
0 siblings, 2 replies; 6+ messages in thread
From: Francesco Lavra @ 2025-10-17 17:32 UTC (permalink / raw)
To: Lorenzo Bianconi, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
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.
Fixes: 801a6e0af0c6c ("iio: imu: st_lsm6dsx: add support to LSM6DSO")
Signed-off-by: Francesco Lavra <flavra@baylibre.com>
---
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
index 3cd520bdec46..a4f558899767 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
@@ -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,
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields
2025-10-17 17:32 [PATCH] iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields Francesco Lavra
@ 2025-10-18 9:33 ` Lorenzo Bianconi
2025-10-18 19:17 ` Jonathan Cameron
2025-10-18 17:30 ` Andy Shevchenko
1 sibling, 1 reply; 6+ messages in thread
From: Lorenzo Bianconi @ 2025-10-18 9:33 UTC (permalink / raw)
To: Francesco Lavra
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
linux-iio, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2403 bytes --]
> 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.
>
> Fixes: 801a6e0af0c6c ("iio: imu: st_lsm6dsx: add support to LSM6DSO")
> Signed-off-by: Francesco Lavra <flavra@baylibre.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> index 3cd520bdec46..a4f558899767 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> @@ -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,
> --
> 2.39.5
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields
2025-10-18 9:33 ` Lorenzo Bianconi
@ 2025-10-18 19:17 ` Jonathan Cameron
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2025-10-18 19:17 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Francesco Lavra, David Lechner, Nuno Sá, Andy Shevchenko,
linux-iio, linux-kernel
On Sat, 18 Oct 2025 11:33:39 +0200
Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> > 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.
> >
> > Fixes: 801a6e0af0c6c ("iio: imu: st_lsm6dsx: add support to LSM6DSO")
> > Signed-off-by: Francesco Lavra <flavra@baylibre.com>
>
> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
>
Applied to the fixes-togreg branch of iio.git and marked for stable.
thanks,
Jonathan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields
2025-10-17 17:32 [PATCH] iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields Francesco Lavra
2025-10-18 9:33 ` Lorenzo Bianconi
@ 2025-10-18 17:30 ` Andy Shevchenko
2025-10-18 18:55 ` Francesco Lavra
1 sibling, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2025-10-18 17:30 UTC (permalink / raw)
To: Francesco Lavra
Cc: Lorenzo Bianconi, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
On Fri, Oct 17, 2025 at 07:32:08PM +0200, Francesco Lavra wrote:
> 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.
...
> +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,
Is it a termination entry? (Looks like that to me) Can we drop trailing comma
while at it?
> +};
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields
2025-10-18 17:30 ` Andy Shevchenko
@ 2025-10-18 18:55 ` Francesco Lavra
2025-10-19 10:46 ` Jonathan Cameron
0 siblings, 1 reply; 6+ messages in thread
From: Francesco Lavra @ 2025-10-18 18:55 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Lorenzo Bianconi, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1157 bytes --]
On Sat, 2025-10-18 at 20:30 +0300, Andy Shevchenko wrote:
> On Fri, Oct 17, 2025 at 07:32:08PM +0200, Francesco Lavra wrote:
> > 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.
>
> ...
>
> > +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,
>
> Is it a termination entry? (Looks like that to me) Can we drop trailing
> comma
> while at it?
Yes, it's a termination entry, I will drop the trailing comma.
> > +};
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields
2025-10-18 18:55 ` Francesco Lavra
@ 2025-10-19 10:46 ` Jonathan Cameron
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2025-10-19 10:46 UTC (permalink / raw)
To: Francesco Lavra
Cc: Andy Shevchenko, Lorenzo Bianconi, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
On Sat, 18 Oct 2025 20:55:40 +0200
Francesco Lavra <flavra@baylibre.com> wrote:
> On Sat, 2025-10-18 at 20:30 +0300, Andy Shevchenko wrote:
> > On Fri, Oct 17, 2025 at 07:32:08PM +0200, Francesco Lavra wrote:
> > > 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.
> >
> > ...
> >
> > > +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,
> >
> > Is it a termination entry? (Looks like that to me) Can we drop trailing
> > comma
> > while at it?
>
> Yes, it's a termination entry, I will drop the trailing comma.
>
> > > +};
I tweaked it. So no need for new version.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-19 10:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17 17:32 [PATCH] iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields Francesco Lavra
2025-10-18 9:33 ` Lorenzo Bianconi
2025-10-18 19:17 ` Jonathan Cameron
2025-10-18 17:30 ` Andy Shevchenko
2025-10-18 18:55 ` Francesco Lavra
2025-10-19 10:46 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox