* [PATCH] iio: imu: inv_mpu6050: use named initializers for temp in hw_info[]
@ 2026-10-18 0:09 Arnav Kapoor
2026-10-20 7:59 ` Joshua Crofts
0 siblings, 1 reply; 5+ messages in thread
From: Arnav Kapoor @ 2026-10-18 0:09 UTC (permalink / raw)
To: Jean-Baptiste Maneyrol, Jonathan Cameron
Cc: David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel, Arnav Kapoor
The temp member of struct inv_mpu6050_hw is initialized positionally
in every entry of hw_info[], as { *_TEMP_OFFSET, *_TEMP_SCALE }. The
order is correct today, but positional initializers of this kind are
how the accel and gyro startup times ended up swapped.
Use designated initializers, as already done for startup_time, so each
value is assigned to the member it is named after.
No functional change.
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
---
Follow-up suggested by Jonathan on the startup time fix:
https://lore.kernel.org/all/20261011045710.357809-1-kapoorarnav43@gmail.com/
Compile-tested (W=1). The object file is byte-identical to the one
built without this patch, apart from debug info.
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 95 +++++++++++++++++-----
1 file changed, 76 insertions(+), 19 deletions(-)
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 3bdcf92472e8..5deddd3c5e80 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -148,7 +148,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6050,
.config = &chip_config_6050,
.fifo_size = 1024,
- .temp = {INV_MPU6050_TEMP_OFFSET, INV_MPU6050_TEMP_SCALE},
+ .temp = {
+ .offset = INV_MPU6050_TEMP_OFFSET,
+ .scale = INV_MPU6050_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6050_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6050_GYRO_STARTUP_TIME,
@@ -160,7 +163,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 512,
- .temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
+ .temp = {
+ .offset = INV_MPU6500_TEMP_OFFSET,
+ .scale = INV_MPU6500_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -172,7 +178,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 512,
- .temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
+ .temp = {
+ .offset = INV_MPU6500_TEMP_OFFSET,
+ .scale = INV_MPU6500_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -184,7 +193,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 4096,
- .temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
+ .temp = {
+ .offset = INV_MPU6500_TEMP_OFFSET,
+ .scale = INV_MPU6500_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -196,7 +208,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6050,
.config = &chip_config_6050,
.fifo_size = 1024,
- .temp = {INV_MPU6050_TEMP_OFFSET, INV_MPU6050_TEMP_SCALE},
+ .temp = {
+ .offset = INV_MPU6050_TEMP_OFFSET,
+ .scale = INV_MPU6050_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6050_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6050_GYRO_STARTUP_TIME,
@@ -208,7 +223,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6050,
.config = &chip_config_6050,
.fifo_size = 1024,
- .temp = {INV_MPU6050_TEMP_OFFSET, INV_MPU6050_TEMP_SCALE},
+ .temp = {
+ .offset = INV_MPU6050_TEMP_OFFSET,
+ .scale = INV_MPU6050_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6050_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6050_GYRO_STARTUP_TIME,
@@ -220,7 +238,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 512,
- .temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
+ .temp = {
+ .offset = INV_MPU6500_TEMP_OFFSET,
+ .scale = INV_MPU6500_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -232,7 +253,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 512,
- .temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
+ .temp = {
+ .offset = INV_MPU6500_TEMP_OFFSET,
+ .scale = INV_MPU6500_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -244,7 +268,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 512,
- .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ .temp = {
+ .offset = INV_ICM20608_TEMP_OFFSET,
+ .scale = INV_ICM20608_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -256,7 +283,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 512,
- .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ .temp = {
+ .offset = INV_ICM20608_TEMP_OFFSET,
+ .scale = INV_ICM20608_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -268,7 +298,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 4 * 1024,
- .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ .temp = {
+ .offset = INV_ICM20608_TEMP_OFFSET,
+ .scale = INV_ICM20608_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -280,7 +313,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 4 * 1024,
- .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ .temp = {
+ .offset = INV_ICM20608_TEMP_OFFSET,
+ .scale = INV_ICM20608_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -292,7 +328,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_icm20602,
.config = &chip_config_6500,
.fifo_size = 1008,
- .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ .temp = {
+ .offset = INV_ICM20608_TEMP_OFFSET,
+ .scale = INV_ICM20608_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_ICM20602_ACCEL_STARTUP_TIME,
.gyro = INV_ICM20602_GYRO_STARTUP_TIME,
@@ -304,7 +343,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_icm20602,
.config = &chip_config_6500,
.fifo_size = 1008,
- .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ .temp = {
+ .offset = INV_ICM20608_TEMP_OFFSET,
+ .scale = INV_ICM20608_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_ICM20602_ACCEL_STARTUP_TIME,
.gyro = INV_ICM20602_GYRO_STARTUP_TIME,
@@ -316,7 +358,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 1024,
- .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ .temp = {
+ .offset = INV_ICM20608_TEMP_OFFSET,
+ .scale = INV_ICM20608_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_ICM20690_ACCEL_STARTUP_TIME,
.gyro = INV_ICM20690_GYRO_STARTUP_TIME,
@@ -327,7 +372,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 512,
- .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ .temp = {
+ .offset = INV_ICM20608_TEMP_OFFSET,
+ .scale = INV_ICM20608_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -339,7 +387,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 512,
- .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ .temp = {
+ .offset = INV_ICM20608_TEMP_OFFSET,
+ .scale = INV_ICM20608_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -351,7 +402,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 4 * 1024,
- .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ .temp = {
+ .offset = INV_ICM20608_TEMP_OFFSET,
+ .scale = INV_ICM20608_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
@@ -363,7 +417,10 @@ static const struct inv_mpu6050_hw hw_info[] = {
.reg = ®_set_6500,
.config = &chip_config_6500,
.fifo_size = 4 * 1024,
- .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ .temp = {
+ .offset = INV_ICM20608_TEMP_OFFSET,
+ .scale = INV_ICM20608_TEMP_SCALE,
+ },
.startup_time = {
.accel = INV_MPU6500_ACCEL_STARTUP_TIME,
.gyro = INV_MPU6500_GYRO_STARTUP_TIME,
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] iio: imu: inv_mpu6050: use named initializers for temp in hw_info[]
2026-10-18 0:09 [PATCH] iio: imu: inv_mpu6050: use named initializers for temp in hw_info[] Arnav Kapoor
@ 2026-10-20 7:59 ` Joshua Crofts
2026-10-21 18:38 ` Arnav Kapoor
0 siblings, 1 reply; 5+ messages in thread
From: Joshua Crofts @ 2026-10-20 7:59 UTC (permalink / raw)
To: Arnav Kapoor
Cc: Jean-Baptiste Maneyrol, Jonathan Cameron, David Lechner,
Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
On Sun, 18 Oct 2026 05:39:13 +0530
Arnav Kapoor <kapoorarnav43@gmail.com> wrote:
> The temp member of struct inv_mpu6050_hw is initialized positionally
> in every entry of hw_info[], as { *_TEMP_OFFSET, *_TEMP_SCALE }. The
> order is correct today, but positional initializers of this kind are
> how the accel and gyro startup times ended up swapped.
>
> Use designated initializers, as already done for startup_time, so each
> value is assigned to the member it is named after.
>
> No functional change.
>
> Suggested-by: Jonathan Cameron <jic23@kernel.org>
> Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
> ---
Your patch fails to apply, please check it out.
--
Kind regards,
Joshua Crofts
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] iio: imu: inv_mpu6050: use named initializers for temp in hw_info[]
2026-10-20 7:59 ` Joshua Crofts
@ 2026-10-21 18:38 ` Arnav Kapoor
2026-10-21 18:53 ` Andy Shevchenko
0 siblings, 1 reply; 5+ messages in thread
From: Arnav Kapoor @ 2026-10-21 18:38 UTC (permalink / raw)
To: joshua.crofts1
Cc: Arnav Kapoor, Jean-Baptiste Maneyrol, Jonathan Cameron,
David Lechner, Nuno Sa, Andy Shevchenko, linux-iio, linux-kernel
On Tue, 20 Oct 2026 09:59:36 +0200, Joshua Crofts wrote:
> Your patch fails to apply, please check it out.
Thanks for trying it. The patch is based on iio.git fixes-togreg, on
top of commit 2b8d4cd20ac8 ("iio: imu: inv_mpu6050: fix swapped accel
and gyro startup times"), which changes the neighbouring .startup_time
lines in every hw_info[] entry. It applies cleanly there, but not on
togreg or testing, which don't have that fix yet. I should have said so
below the ---, sorry.
Jonathan, I can resend once that fix has reached togreg, or rebase it
however you prefer.
Thanks,
Arnav
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] iio: imu: inv_mpu6050: use named initializers for temp in hw_info[]
2026-10-21 18:38 ` Arnav Kapoor
@ 2026-10-21 18:53 ` Andy Shevchenko
2026-10-21 20:56 ` Arnav Kapoor
0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2026-10-21 18:53 UTC (permalink / raw)
To: Arnav Kapoor
Cc: joshua.crofts1, Jean-Baptiste Maneyrol, Jonathan Cameron,
David Lechner, Nuno Sa, Andy Shevchenko, linux-iio, linux-kernel
On Thu, Oct 22, 2026 at 12:08:00AM +0530, Arnav Kapoor wrote:
> On Tue, 20 Oct 2026 09:59:36 +0200, Joshua Crofts wrote:
> > Your patch fails to apply, please check it out.
>
> Thanks for trying it. The patch is based on iio.git fixes-togreg, on
> top of commit 2b8d4cd20ac8 ("iio: imu: inv_mpu6050: fix swapped accel
> and gyro startup times"), which changes the neighbouring .startup_time
> lines in every hw_info[] entry. It applies cleanly there, but not on
> togreg or testing, which don't have that fix yet. I should have said so
> below the ---, sorry.
just use --base next time when formatting patch (with `git format-patch`).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] iio: imu: inv_mpu6050: use named initializers for temp in hw_info[]
2026-10-21 18:53 ` Andy Shevchenko
@ 2026-10-21 20:56 ` Arnav Kapoor
0 siblings, 0 replies; 5+ messages in thread
From: Arnav Kapoor @ 2026-10-21 20:56 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Joshua Crofts, Jean-Baptiste Maneyrol, Jonathan Cameron,
David Lechner, Nuno Sa, Andy Shevchenko, linux-iio, linux-kernel
On Wed, 21 Oct 2026 21:53:36 +0300, Andy Shevchenko wrote:
> just use --base next time when formatting patch (with `git format-patch`).
Will do, thanks. For this one, the base was:
base-commit: 28691515f54f03f23636cbf1ee2cd60fc31e2353
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-21 20:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-18 0:09 [PATCH] iio: imu: inv_mpu6050: use named initializers for temp in hw_info[] Arnav Kapoor
2026-10-20 7:59 ` Joshua Crofts
2026-10-21 18:38 ` Arnav Kapoor
2026-10-21 18:53 ` Andy Shevchenko
2026-10-21 20:56 ` Arnav Kapoor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®