Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] iio: imu: inv_icm42600: change invalid data error to EBUSY
@ 2025-08-08  7:40 Jean-Baptiste Maneyrol via B4 Relay
  2025-08-08 12:35 ` Andy Shevchenko
  2025-08-09 19:24 ` Jonathan Cameron
  0 siblings, 2 replies; 5+ messages in thread
From: Jean-Baptiste Maneyrol via B4 Relay @ 2025-08-08  7:40 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
  Cc: Jean-Baptiste Maneyrol, Jonathan Cameron, linux-iio, linux-kernel,
	Jean-Baptiste Maneyrol, stable

From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>

Temperature sensor returns the temperature of the mechanical parts
of the chip. If both accel and gyro are off, temperature sensor is
also automatically turned off and return invalid data.

In this case, returning EBUSY error code is better then EINVAL and
indicates userspace that it needs to retry reading temperature in
another context.

Fixes: bc3eb0207fb5 ("iio: imu: inv_icm42600: add temperature sensor support")
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Cc: stable@vger.kernel.org
---
 drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c
index 8b15afca498cb5dfa7e056a60d3c78e419f11b29..1756f3d07049a26038776a35d9242f3dd1320354 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c
@@ -32,8 +32,12 @@ static int inv_icm42600_temp_read(struct inv_icm42600_state *st, s16 *temp)
 		goto exit;
 
 	*temp = (s16)be16_to_cpup(raw);
+	/*
+	 * Temperature data is invalid if both accel and gyro are off.
+	 * Return EBUSY in this case.
+	 */
 	if (*temp == INV_ICM42600_DATA_INVALID)
-		ret = -EINVAL;
+		ret = -EBUSY;
 
 exit:
 	mutex_unlock(&st->lock);

---
base-commit: 6408dba154079656d069a6a25fb3a8954959474c
change-id: 20250807-inv-icm42600-change-temperature-error-code-65d16a98c6e1

Best regards,
-- 
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-11 20:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08  7:40 [PATCH] iio: imu: inv_icm42600: change invalid data error to EBUSY Jean-Baptiste Maneyrol via B4 Relay
2025-08-08 12:35 ` Andy Shevchenko
2025-08-11 20:36   ` Jonathan Cameron
2025-08-09 19:24 ` Jonathan Cameron
2025-08-11  9:49   ` Sean Nyekjaer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox