mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnav Kapoor <kapoorarnav43@gmail.com>
To: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>,
	Jonathan Cameron <jic23@kernel.org>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Arnav Kapoor" <kapoorarnav43@gmail.com>
Subject: [PATCH] iio: imu: inv_mpu6050: use named initializers for temp in hw_info[]
Date: Sun, 18 Oct 2026 05:39:13 +0530	[thread overview]
Message-ID: <20261018000924.758186-1-kapoorarnav43@gmail.com> (raw)

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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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 = &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


             reply	other threads:[~2026-10-18  0:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18  0:09 Arnav Kapoor [this message]
2026-10-20  7:59 ` Joshua Crofts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261018000924.758186-1-kapoorarnav43@gmail.com \
    --to=kapoorarnav43@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jean-baptiste.maneyrol@tdk.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®