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 09:21, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Tue, May 05, 2026 at 09:07:30AM +0200, Joshua Crofts wrote:
> > 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.
>
> It's better to integrate it into the series either as a fix (should be first in
> the series) or as just an improvement after readx_*() conversion patch.

Better to do it as an improvement after readx_(), rebasing would be easier. I do
agree with it being added as a separate patch though.

--
Kind regards

CJD

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