* [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
* Re: [PATCH] iio: imu: inv_icm42600: change invalid data error to EBUSY
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
1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2025-08-08 12:35 UTC (permalink / raw)
To: jean-baptiste.maneyrol
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Jean-Baptiste Maneyrol, Jonathan Cameron, linux-iio, linux-kernel,
stable
On Fri, Aug 8, 2025 at 9:40 AM Jean-Baptiste Maneyrol via B4 Relay
<devnull+jean-baptiste.maneyrol.tdk.com@kernel.org> wrote:
>
> Temperature sensor returns the temperature of the mechanical parts
> of the chip. If both accel and gyro are off, temperature sensor is
the temperature
> also automatically turned off and return invalid data.
returns
> In this case, returning EBUSY error code is better then EINVAL and
-EBUSY
than
-EINVAL
> indicates userspace that it needs to retry reading temperature in
> another context.
...
> + /*
> + * Temperature data is invalid if both accel and gyro are off.
> + * Return EBUSY in this case.
-EBUSY
> + */
> if (*temp == INV_ICM42600_DATA_INVALID)
> - ret = -EINVAL;
> + ret = -EBUSY;
>
> exit:
> mutex_unlock(&st->lock);
...
No need to resend just for the above, I hope Jonathan tweaks this
whilst applying.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
(assuming typos and signs are fixed)
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: imu: inv_icm42600: change invalid data error to EBUSY
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-09 19:24 ` Jonathan Cameron
2025-08-11 9:49 ` Sean Nyekjaer
1 sibling, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2025-08-09 19:24 UTC (permalink / raw)
To: Jean-Baptiste Maneyrol via B4 Relay
Cc: jean-baptiste.maneyrol, David Lechner, Nuno Sá,
Andy Shevchenko, Jean-Baptiste Maneyrol, Jonathan Cameron,
linux-iio, linux-kernel, stable, Sean Nyekjaer
On Fri, 08 Aug 2025 09:40:10 +0200
Jean-Baptiste Maneyrol via B4 Relay <devnull+jean-baptiste.maneyrol.tdk.com@kernel.org> wrote:
> 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
+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,
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: imu: inv_icm42600: change invalid data error to EBUSY
2025-08-09 19:24 ` Jonathan Cameron
@ 2025-08-11 9:49 ` Sean Nyekjaer
0 siblings, 0 replies; 5+ messages in thread
From: Sean Nyekjaer @ 2025-08-11 9:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Jean-Baptiste Maneyrol via B4 Relay, jean-baptiste.maneyrol,
David Lechner, Nuno Sá, Andy Shevchenko,
Jean-Baptiste Maneyrol, Jonathan Cameron, linux-iio, linux-kernel,
stable
On Sat, Aug 09, 2025 at 08:24:40PM +0100, Jonathan Cameron wrote:
> On Fri, 08 Aug 2025 09:40:10 +0200
> Jean-Baptiste Maneyrol via B4 Relay <devnull+jean-baptiste.maneyrol.tdk.com@kernel.org> wrote:
>
> > 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
> +CC Sean who raised the issue.
Reviewed-by: Sean Nyekjaer <sean@geanix.com>
>
> > ---
> > 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,
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: imu: inv_icm42600: change invalid data error to EBUSY
2025-08-08 12:35 ` Andy Shevchenko
@ 2025-08-11 20:36 ` Jonathan Cameron
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2025-08-11 20:36 UTC (permalink / raw)
To: Andy Shevchenko
Cc: jean-baptiste.maneyrol, David Lechner, Nuno Sá,
Andy Shevchenko, Jean-Baptiste Maneyrol, Jonathan Cameron,
linux-iio, linux-kernel, stable
On Fri, 8 Aug 2025 14:35:00 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Fri, Aug 8, 2025 at 9:40 AM Jean-Baptiste Maneyrol via B4 Relay
> <devnull+jean-baptiste.maneyrol.tdk.com@kernel.org> wrote:
> >
> > Temperature sensor returns the temperature of the mechanical parts
> > of the chip. If both accel and gyro are off, temperature sensor is
>
> the temperature
>
> > also automatically turned off and return invalid data.
>
> returns
>
> > In this case, returning EBUSY error code is better then EINVAL and
>
> -EBUSY
> than
> -EINVAL
>
> > indicates userspace that it needs to retry reading temperature in
> > another context.
>
> ...
>
> > + /*
> > + * Temperature data is invalid if both accel and gyro are off.
> > + * Return EBUSY in this case.
>
> -EBUSY
>
> > + */
> > if (*temp == INV_ICM42600_DATA_INVALID)
> > - ret = -EINVAL;
> > + ret = -EBUSY;
> >
> > exit:
> > mutex_unlock(&st->lock);
>
> ...
>
> No need to resend just for the above, I hope Jonathan tweaks this
> whilst applying.
> Reviewed-by: Andy Shevchenko <andy@kernel.org>
> (assuming typos and signs are fixed)
>
Tweaked an applied to the fixes-togreg branch of iio.git.
I've not marked this explicitly for stable as it's a kind of weird
sort of 'fix'. If anyone wants is backported, then maybe we can consider
that once it's upstream
Jonathan
^ permalink raw reply [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;
as well as URLs for NNTP newsgroup(s).