Skip to contentSkip to conversation

iio: adc: nxp-sar-adc: Remove unnecessary type casting

PATCH In review Felix Gu 3 participants 4 messages Feb 21 – Feb 23 IIO

lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH 1/1 iio: adc: nxp-sar-adc: Remove unnecessary type casting

The readl_poll_timeout() macro returns a signed integer error code.

In nxp_sar_adc_calibration_wait(), the return value is casted to u32 before being returned as int, which is unnecessary.

---
 drivers/iio/adc/nxp-sar-adc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/nxp-sar-adc.c +2 -1
index 9efa883c277d..a6e4888a8464 100644
@@ -247,7 +247,8 @@ static inline void nxp_sar_adc_calibration_start(void __iomem *base)
 
 static inline int nxp_sar_adc_calibration_wait(void __iomem *base)
 {
-	u32 msr, ret;
+	u32 msr;
+	int ret;
 
 	ret = readl_poll_timeout(NXP_SAR_ADC_MSR(base), msr,
 				 !FIELD_GET(NXP_SAR_ADC_MSR_CALBUSY, msr),

---
base-commit: d4906ae14a5f136ceb671bb14cedbf13fa560da6
change-id: 20260222-nxp-sar-adc-1906a65ce5b6

Best regards,

Signature · 1 line
Felix Gu <[email protected]>
maintainer
#1 lore raw
Quoted 6 lines · On Sun, 22 Feb 2026 02:09:08 +0800 Felix Gu <[email protected]> wrote:

The readl_poll_timeout() macro returns a signed integer error code.

In nxp_sar_adc_calibration_wait(), the return value is casted to u32 before being returned as int, which is unnecessary.

Hi Felix,

Make sure to include the author of the code you are touching in the +CC list. Added Daniel.

I think this is simple enough, so I've picked it up now but I'm fine adding tags or indeed dropping it if other reviews come in. I'll be rebasing or rc1 later in the week.

Applied to the testing branch of iio.git

Thanks,

Jonathan

Quoted 24 lines
---
 drivers/iio/adc/nxp-sar-adc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/nxp-sar-adc.c +2 -2
index 9efa883c277d..a6e4888a8464 100644
@@ -247,7 +247,8 @@ static inline void nxp_sar_adc_calibration_start(void __iomem *base)
 
 static inline int nxp_sar_adc_calibration_wait(void __iomem *base)
 {
-	u32 msr, ret;
+	u32 msr;
+	int ret;
 
 	ret = readl_poll_timeout(NXP_SAR_ADC_MSR(base), msr,
 				 !FIELD_GET(NXP_SAR_ADC_MSR_CALBUSY, msr),
 
---

base-commit: d4906ae14a5f136ceb671bb14cedbf13fa560da6
change-id: 20260222-nxp-sar-adc-1906a65ce5b6

Best regards,

author
#2 lore raw
Quoted 41 lines · Jonathan Cameron
Quoted 6 lines · On Sun, 22 Feb 2026 02:09:08 +0800 Felix Gu <[email protected]> wrote:

The readl_poll_timeout() macro returns a signed integer error code.

In nxp_sar_adc_calibration_wait(), the return value is casted to u32 before being returned as int, which is unnecessary.

Hi Felix,

Make sure to include the author of the code you are touching in the +CC list. Added Daniel.

I think this is simple enough, so I've picked it up now but I'm fine adding tags or indeed dropping it if other reviews come in. I'll be rebasing or rc1 later in the week.

Applied to the testing branch of iio.git

Thanks,

Jonathan

Quoted 16 lines
---
 drivers/iio/adc/nxp-sar-adc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/nxp-sar-adc.c +2 -1
index 9efa883c277d..a6e4888a8464 100644
@@ -247,7 +247,8 @@ static inline void nxp_sar_adc_calibration_start(void __iomem *base)
 
 static inline int nxp_sar_adc_calibration_wait(void __iomem *base)
 {
-     u32 msr, ret;
+     u32 msr;
+     int ret;
 
Quoted 9 lines
Quoted 8 lines
drivers/iio/adc/nxp-sar-adc.c +0 -1
      ret = readl_poll_timeout(NXP_SAR_ADC_MSR(base), msr,
                               !FIELD_GET(NXP_SAR_ADC_MSR_CALBUSY, msr),
 
---

base-commit: d4906ae14a5f136ceb671bb14cedbf13fa560da6
change-id: 20260222-nxp-sar-adc-1906a65ce5b6

Best regards,

Hi Jonathan,

Thank you for the reminder.

I used b4 prep --auto-to-cc and am not sure why Daniel's email was missed in this patch, as it was correctly included in another patch.

Best regards,
Felix

#3 lore raw
Quoted 11 lines · Felix Gu
Quoted 10 lines · Jonathan Cameron

On Sun, 22 Feb 2026 02:09:08 +0800
Felix Gu <[email protected]> wrote:

Make sure to include the author of the code you are touching in the +CC list. Added Daniel.

I think this is simple enough, so I've picked it up now but I'm fine adding tags or indeed dropping it if other reviews come in. I'll be rebasing or rc1 later in the week.

Quoted 6 lines
Quoted 1 line

Applied to the testing branch of iio.git

Thank you for the reminder.

I used b4 prep --auto-to-cc and am not sure why Daniel's email was missed in this patch, as it was correctly included in another patch.

Please, do *remove* the context that is unrelated to the reply. See this email as an example. Do not waste others' time on this.

Signature · 2 lines
With Best Regards,
Andy Shevchenko