Re: [PATCH v3 5/6] iio: magnetometer: ak8975: fix wrong errno on return
From: Joshua Crofts
Date: Wed Apr 22 2026 - 09:36:04 EST
On Wed, 22 Apr 2026 at 15:13, Andy Shevchenko
<andriy.shevchenko@xxxxxxxxx> wrote:
> 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?
Sure, I know that these are just regular errno.h codes, I could've elaborated
a bit more in the commit message.
> 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.
That is odd, it definitely should be -ETIMEDOUT.
> 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.
This driver has more issues than I expected...
--
Kind regards
CJD