Re: [PATCH v2 0/4] iio: proximity: aw96103: fix diff sign, missing config, async config lifetime and event values

From: Jonathan Cameron

Date: Fri Dec 04 2026 - 18:45:45 EST


On Mon, 30 Nov 2026 16:43:18 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:

> On Mon, Nov 30, 2026 at 12:34:29AM +0000, Jonathan Cameron wrote:
> >
> > > - 4: kept the explicit range check rather than FIELD_FIT() (Jonathan):
> > > on 32-bit, FIELD_FIT() shifts the value in a 32-bit unsigned long, so
> > > high bits fall off and e.g. 16777216 or INT_MIN pass as fitting the
> > > OUTDEB field and are written as 0 (1020 such int values for
> > > GENMASK(9, 8), 16380 for GENMASK(13, 12)); on 64-bit it is exact.
> >
> > Interesting point. I'd never looked at it closely.
> >
> > I wonder if their is appetite to fix that?
> > Would simply shifting the the mask right instead of the value left when checking
> > the fit do the job? That might end up more expensive if the aim is simply to
> > avoid overwriting other fields as the compiler might figure out how to combine
> > the guts of FIELD_FIT with other necessary steps. Perhaps have a play around
> > and see if it manages that or not?
> >
> > What do others think?
>
> Sounds like a bug in FIELD_FIT() to me that calls to be fixed.
>

Great to see a proposed fix for FIELD_FIT() on the list.
I don't want to potentially block these fixes as a result
(or keep track of them just for this!) so I'll apply these
now. Perhaps Arnav can circle back and switch to the 'fixed'
FIELD_FIT() as a follow up cleanup next cycle.

Applied to the testing branch of iio.git and marked for stable.
The fixes-togreg tree is now more or less closed for this cycle
just due to timing and my likely availability over next few weeks.

Thanks,

Jonathan