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

Piyush Patle posted 1 patch 2 months, 1 week ago
drivers/iio/adc/nxp-sar-adc.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
[PATCH v2] iio: adc: nxp-sar-adc: use field_get() for EOC bit check
Posted by Piyush Patle 2 months, 1 week ago
Use field_get() here now that runtime-mask support exists, and drop
the obsolete TODO. Since NXP_SAR_ADC_EOC_CH(c) is BIT(c), the
resulting !-test is semantically identical.

No functional change.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
---
 drivers/iio/adc/nxp-sar-adc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/iio/adc/nxp-sar-adc.c b/drivers/iio/adc/nxp-sar-adc.c
index 58103bf16aff..d6c2a0d50bb4 100644
--- a/drivers/iio/adc/nxp-sar-adc.c
+++ b/drivers/iio/adc/nxp-sar-adc.c
@@ -316,11 +316,7 @@ static int nxp_sar_adc_read_data(struct nxp_sar_adc *info, unsigned int chan)
 
 	ceocfr = readl(NXP_SAR_ADC_CEOCFR0(info->regs));
 
-	/*
-	 * FIELD_GET() can not be used here because EOC_CH is not constant.
-	 * TODO: Switch to field_get() when it will be available.
-	 */
-	if (!(NXP_SAR_ADC_EOC_CH(chan) & ceocfr))
+	if (!field_get(NXP_SAR_ADC_EOC_CH(chan), ceocfr))
 		return -EIO;
 
 	cdr = readl(NXP_SAR_ADC_CDR(info->regs, chan));
-- 
2.43.0
Re: [PATCH v2] iio: adc: nxp-sar-adc: use field_get() for EOC bit check
Posted by Daniel Lezcano 2 months, 1 week ago
On 4/10/26 23:41, Piyush Patle wrote:
> Use field_get() here now that runtime-mask support exists, and drop
> the obsolete TODO. Since NXP_SAR_ADC_EOC_CH(c) is BIT(c), the
> resulting !-test is semantically identical.
> 
> No functional change.
> 
> Reviewed-by: David Lechner <dlechner@baylibre.com>
> Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>

Acked-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>

> ---
>   drivers/iio/adc/nxp-sar-adc.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/nxp-sar-adc.c b/drivers/iio/adc/nxp-sar-adc.c
> index 58103bf16aff..d6c2a0d50bb4 100644
> --- a/drivers/iio/adc/nxp-sar-adc.c
> +++ b/drivers/iio/adc/nxp-sar-adc.c
> @@ -316,11 +316,7 @@ static int nxp_sar_adc_read_data(struct nxp_sar_adc *info, unsigned int chan)
>   
>   	ceocfr = readl(NXP_SAR_ADC_CEOCFR0(info->regs));
>   
> -	/*
> -	 * FIELD_GET() can not be used here because EOC_CH is not constant.
> -	 * TODO: Switch to field_get() when it will be available.
> -	 */
> -	if (!(NXP_SAR_ADC_EOC_CH(chan) & ceocfr))
> +	if (!field_get(NXP_SAR_ADC_EOC_CH(chan), ceocfr))
>   		return -EIO;
>   
>   	cdr = readl(NXP_SAR_ADC_CDR(info->regs, chan));
Re: [PATCH v2] iio: adc: nxp-sar-adc: use field_get() for EOC bit check
Posted by Piyush Patle 2 months ago
On Sat, Apr 11, 2026 at 7:53 PM Daniel Lezcano
<daniel.lezcano@oss.qualcomm.com> wrote:
>
> On 4/10/26 23:41, Piyush Patle wrote:
> > Use field_get() here now that runtime-mask support exists, and drop
> > the obsolete TODO. Since NXP_SAR_ADC_EOC_CH(c) is BIT(c), the
> > resulting !-test is semantically identical.
> >
> > No functional change.
> >
> > Reviewed-by: David Lechner <dlechner@baylibre.com>
> > Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
>
> Acked-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
>
> > ---
> >   drivers/iio/adc/nxp-sar-adc.c | 6 +-----
> >   1 file changed, 1 insertion(+), 5 deletions(-)
> >
> > diff --git a/drivers/iio/adc/nxp-sar-adc.c b/drivers/iio/adc/nxp-sar-adc.c
> > index 58103bf16aff..d6c2a0d50bb4 100644
> > --- a/drivers/iio/adc/nxp-sar-adc.c
> > +++ b/drivers/iio/adc/nxp-sar-adc.c
> > @@ -316,11 +316,7 @@ static int nxp_sar_adc_read_data(struct nxp_sar_adc *info, unsigned int chan)
> >
> >       ceocfr = readl(NXP_SAR_ADC_CEOCFR0(info->regs));
> >
> > -     /*
> > -      * FIELD_GET() can not be used here because EOC_CH is not constant.
> > -      * TODO: Switch to field_get() when it will be available.
> > -      */
> > -     if (!(NXP_SAR_ADC_EOC_CH(chan) & ceocfr))
> > +     if (!field_get(NXP_SAR_ADC_EOC_CH(chan), ceocfr))
> >               return -EIO;
> >
> >       cdr = readl(NXP_SAR_ADC_CDR(info->regs, chan));
>

Hi,
Gentle ping on this patch.

I’d appreciate any feedback whenever you get time, or let me know if I
should resend/rework anything.

Regards,
Piyush
Re: [PATCH v2] iio: adc: nxp-sar-adc: use field_get() for EOC bit check
Posted by Jonathan Cameron 2 months ago
On Sun, 19 Apr 2026 22:30:19 +0530
Piyush Patle <piyushpatle228@gmail.com> wrote:

> On Sat, Apr 11, 2026 at 7:53 PM Daniel Lezcano
> <daniel.lezcano@oss.qualcomm.com> wrote:
> >
> > On 4/10/26 23:41, Piyush Patle wrote:  
> > > Use field_get() here now that runtime-mask support exists, and drop
> > > the obsolete TODO. Since NXP_SAR_ADC_EOC_CH(c) is BIT(c), the
> > > resulting !-test is semantically identical.
> > >
> > > No functional change.
> > >
> > > Reviewed-by: David Lechner <dlechner@baylibre.com>
> > > Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>  
> >
> > Acked-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
Applied. Thanks,

J
> >  
> > > ---
> > >   drivers/iio/adc/nxp-sar-adc.c | 6 +-----
> > >   1 file changed, 1 insertion(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/iio/adc/nxp-sar-adc.c b/drivers/iio/adc/nxp-sar-adc.c
> > > index 58103bf16aff..d6c2a0d50bb4 100644
> > > --- a/drivers/iio/adc/nxp-sar-adc.c
> > > +++ b/drivers/iio/adc/nxp-sar-adc.c
> > > @@ -316,11 +316,7 @@ static int nxp_sar_adc_read_data(struct nxp_sar_adc *info, unsigned int chan)
> > >
> > >       ceocfr = readl(NXP_SAR_ADC_CEOCFR0(info->regs));
> > >
> > > -     /*
> > > -      * FIELD_GET() can not be used here because EOC_CH is not constant.
> > > -      * TODO: Switch to field_get() when it will be available.
> > > -      */
> > > -     if (!(NXP_SAR_ADC_EOC_CH(chan) & ceocfr))
> > > +     if (!field_get(NXP_SAR_ADC_EOC_CH(chan), ceocfr))
> > >               return -EIO;
> > >
> > >       cdr = readl(NXP_SAR_ADC_CDR(info->regs, chan));  
> >  
> 
> Hi,
> Gentle ping on this patch.
> 
> I’d appreciate any feedback whenever you get time, or let me know if I
> should resend/rework anything.
> 
> Regards,
> Piyush