lkml.org 
[lkml]   [2026]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v4 06/17] iio: magnetometer: ak8975: modernize polling loops with iopoll() macros
On Tue, 5 May 2026 at 06:58, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, May 04, 2026 at 04:06:06PM +0100, Jonathan Cameron wrote:
> > On Mon, 04 May 2026 11:48:18 +0200
> > Joshua Crofts via B4 Relay <devnull+joshua.crofts1.gmail.com@kernel.org> wrote:
>
> ...
>
> > One question inline on whether it is a good idea to be paranoid about
> > gpiod_get_value() potentially returning < 0 to indicate an error.
> > Right now that is treated as success.
>
> > > + ret = readx_poll_timeout(gpiod_get_value, data->eoc_gpiod, val, val != 0,
> > > + AK8975_CONVERSION_DONE_POLL_TIME * USEC_PER_MSEC,
> > > + AK8975_MAX_CONVERSION_TIMEOUT * USEC_PER_MSEC);
> > > + if (ret)
> > > + return ret;
> >
> > Should we check val as well? It might be negative if gpiod_get_value()
> > returned an error.. Obviously the original code didn't so this would be an
> > improvement rather than maintaining what that was doing.
>
> I agree that this would be a good addition, but since it's a behavioural change
> I think the separate patch should be made (perhaps after readx_*() conversion
> as it makes it easier to do).

Good point, val should definitely be checked. Will send a fix this afternoon.

--
Kind regards

CJD

\
 
 \ /
  Last update: 2026-05-05 09:08    [W:0.113 / U:42.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog