Skip to contentSkip to conversation

iio: adc: nxp-sar-adc: use field_get() for EOC bit check

PATCH Applied Piyush Patle 3 participants 4 messages Apr 10 – Apr 20 IIO

lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/iio/adc/nxp-sar-adc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/iio/adc/nxp-sar-adc.c +1 -5
index 58103bf16aff..d6c2a0d50bb4 100644
@@ -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));
Signature · 1 line
2.43.0
Acked-by on v2 1/1
#1 lore raw
Quoted 8 lines · Piyush Patle

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.

Quoted 21 lines
---
  drivers/iio/adc/nxp-sar-adc.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/iio/adc/nxp-sar-adc.c +1 -5
index 58103bf16aff..d6c2a0d50bb4 100644
@@ -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 lore raw
Quoted 33 lines · Daniel Lezcano
Quoted 8 lines · Piyush Patle

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.

Quoted 20 lines
---
  drivers/iio/adc/nxp-sar-adc.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/iio/adc/nxp-sar-adc.c +1 -5
index 58103bf16aff..d6c2a0d50bb4 100644
@@ -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;
 
Quoted 2 lines

drivers/iio/adc/nxp-sar-adc.c static int nxp_sar_adc_read_data(struct nxp_sar_adc *info, unsigned int chan) · line 322

Quoted 1 line
drivers/iio/adc/nxp-sar-adc.c +0 -0
      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

maintainer Applied
#3 lore raw
Quoted 8 lines · On Sun, 19 Apr 2026 22:30:19 +0530 Piyush Patle <[email protected]>…
Quoted 6 lines · Daniel Lezcano
Quoted 4 lines · Piyush Patle

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.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

No functional change.

Applied. Thanks,

J

Quoted 32 lines
Quoted 21 lines
Quoted 21 lines
 
---
  drivers/iio/adc/nxp-sar-adc.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/iio/adc/nxp-sar-adc.c +1 -5
index 58103bf16aff..d6c2a0d50bb4 100644
@@ -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;
 
Quoted 2 lines

drivers/iio/adc/nxp-sar-adc.c static int nxp_sar_adc_read_data(struct nxp_sar_adc *info, unsigned int chan) · line 322

Quoted 1 line
drivers/iio/adc/nxp-sar-adc.c +0 -0
      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