Skip to content

Commit dfdc31e

Browse files
jmaneyrol-invnjic23
authored andcommitted
iio: imu: inv_icm42600: change invalid data error to -EBUSY
Temperature sensor returns the temperature of the mechanical parts of the chip. If both accel and gyro are off, the temperature sensor is also automatically turned off and returns 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: bc3eb02 ("iio: imu: inv_icm42600: add temperature sensor support") Signed-off-by: Jean-Baptiste Maneyrol <[email protected]> Cc: [email protected] Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Sean Nyekjaer <[email protected]> Link: https://patch.msgid.link/20250808-inv-icm42600-change-temperature-error-code-v1-1-986fbf63b77d@tdk.com Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 197e299 commit dfdc31e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ static int inv_icm42600_temp_read(struct inv_icm42600_state *st, s16 *temp)
3232
goto exit;
3333

3434
*temp = (s16)be16_to_cpup(raw);
35+
/*
36+
* Temperature data is invalid if both accel and gyro are off.
37+
* Return -EBUSY in this case.
38+
*/
3539
if (*temp == INV_ICM42600_DATA_INVALID)
36-
ret = -EINVAL;
40+
ret = -EBUSY;
3741

3842
exit:
3943
mutex_unlock(&st->lock);

0 commit comments

Comments
 (0)