Re: [PATCH] iio: adc: nxp-sar-adc: use field_get() for EOC bit check

From: Piyush Patle

Date: Fri Apr 10 2026 - 17:48:48 EST


> On 4/10/26 4:13 PM, Piyush Patle wrote:
> > The driver uses FIELD_GET() for constant-mask fields but falls back
> > to a raw bit test for the per-channel EOC bit, as the mask depends
> > on the runtime channel index. A TODO notes that this should switch
> > to field_get() when available.
>
> Could drop this first paragraph, it is a bit redundant.
>
> >
> > Use field_get() here now that runtime-mask support exists, and drop
>
> We like for commit messages to start with the verb like this, so
> this would be ideal for the first paragraph of the commit message.

I have addressed all your comments.

>
> > the obsolete TODO. Since NXP_SAR_ADC_EOC_CH(c) is BIT(c), the
> > resulting !-test is semantically identical.
> >
> > No functional change.
> >
> > Signed-off-by: Piyush Patle <piyushpatle228@xxxxxxxxx>
> > ---
> Reviewed-by: David Lechner <dlechner@xxxxxxxxxxxx>
>

Thanks for the review. Sent v2!

>
> And if you are interested in doing more like this, search the IIO
> subsystem for __ffs. If it is used with << or >> then there is a
> good chance it could be replaced with field_get() or field_prep().
>

I'll also look for similar __ffs() patterns in IIO and convert them
to field_get()/field_prep() where appropriate.