[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250809202440.552e1cdf@jic23-huawei>
Date: Sat, 9 Aug 2025 20:24:40 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Jean-Baptiste Maneyrol via B4 Relay
<devnull+jean-baptiste.maneyrol.tdk.com@...nel.org>
Cc: jean-baptiste.maneyrol@....com, David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>, Andy Shevchenko
<andy@...nel.org>, Jean-Baptiste Maneyrol <jmaneyrol@...ensense.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org, Sean Nyekjaer
<sean@...nix.com>
Subject: Re: [PATCH] iio: imu: inv_icm42600: change invalid data error to
EBUSY
On Fri, 08 Aug 2025 09:40:10 +0200
Jean-Baptiste Maneyrol via B4 Relay <devnull+jean-baptiste.maneyrol.tdk.com@...nel.org> wrote:
> From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@....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@....com>
> Cc: stable@...r.kernel.org
+CC Sean who raised the issue.
> ---
> 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,
Powered by blists - more mailing lists