Re: [PATCH v3 5/6] iio: magnetometer: ak8975: fix wrong errno on return
From: Andy Shevchenko
Date: Wed Apr 22 2026 - 09:19:30 EST
On Wed, Apr 22, 2026 at 11:22:06AM +0000, Joshua Crofts wrote:
> The driver currently returns -EINVAL on polling timeout instead of
> -ETIMEDOUT.
>
> Replace return code for -ETIMEDOUT and remove unnecessary error message
> as error is described enough by error code.
The idea is to drop messages because this is well established error code
and we have a POSIX message being associated with that (meaning all libc
implementations should follow). That said, it's not described by the error
code, it can simply be retrieved from libc *based on the error code*.
Can you rephrase that?
...
You also want to align the code in
https://elixir.bootlin.com/linux/v7.0/source/drivers/iio/magnetometer/ak8975.c#L700
The all three wait_conv...*() are called by the same user in a single
if-else-if chain.
There are two definitions:
#define ETIME 62 /* Timer expired */
#define ETIMEDOUT 110 /* Connection timed out */
For IO the first one makes no sense.
The driver says
` /* Wait for the conversion to complete. */
which implies the IO with the device, and "Connection timed out" maybe not
the clearest form of it but better than "Timer expired" which rather misleading.
--
With Best Regards,
Andy Shevchenko