* [PATCH] iio: adc: ti-adc12138: fail init on calibration timeout
@ 2026-06-15 11:09 Prashant Rahul
2026-06-15 12:12 ` John Ogness
2026-06-15 13:54 ` Andy Shevchenko
0 siblings, 2 replies; 4+ messages in thread
From: Prashant Rahul @ 2026-06-15 11:09 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: Shuah Khan, Prashant Rahul, David Lechner, Nuno Sá,
Andy Shevchenko, Petr Mladek, Krzysztof Kozlowski, John Ogness,
Oleg Nesterov, linux-kernel
adc12138_init() starts device calibration and waits for the EOC
interrupt before checking the calibration status. The wait helper
returns -ETIMEDOUT if the interrupt does not arrive in time, but the
init path ignores the error and continues probing the device. This could
lead to registering the device even tho it may not be properly
initialized.
Return the wait error so probe fails cleanly when calibration does not
complete.
Signed-off-by: Prashant Rahul <prashantrahul23@gmail.com>
---
drivers/iio/adc/ti-adc12138.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ti-adc12138.c b/drivers/iio/adc/ti-adc12138.c
index e5ec4b073daa..1f5f4b7794c1 100644
--- a/drivers/iio/adc/ti-adc12138.c
+++ b/drivers/iio/adc/ti-adc12138.c
@@ -300,7 +300,11 @@ static int adc12138_init(struct adc12138 *adc)
if (status < 0)
return status;
- adc12138_wait_eoc(adc, msecs_to_jiffies(100));
+ ret = adc12138_wait_eoc(adc, msecs_to_jiffies(100));
+ if (ret) {
+ dev_warn(&adc->spi->dev, "wait eoc timeout\n");
+ return ret;
+ }
status = adc12138_read_status(adc);
if (status & ADC12138_STATUS_CAL) {
--
2.54.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] iio: adc: ti-adc12138: fail init on calibration timeout
2026-06-15 11:09 [PATCH] iio: adc: ti-adc12138: fail init on calibration timeout Prashant Rahul
@ 2026-06-15 12:12 ` John Ogness
2026-06-16 10:14 ` Prashant Rahul
2026-06-15 13:54 ` Andy Shevchenko
1 sibling, 1 reply; 4+ messages in thread
From: John Ogness @ 2026-06-15 12:12 UTC (permalink / raw)
To: Prashant Rahul, Jonathan Cameron, linux-iio
Cc: Shuah Khan, Prashant Rahul, David Lechner, Nuno Sá,
Andy Shevchenko, Petr Mladek, Krzysztof Kozlowski, Oleg Nesterov,
linux-kernel
On 2026-06-15, Prashant Rahul <prashantrahul23@gmail.com> wrote:
> adc12138_init() starts device calibration and waits for the EOC
> interrupt before checking the calibration status. The wait helper
> returns -ETIMEDOUT if the interrupt does not arrive in time, but the
> init path ignores the error and continues probing the device. This could
> lead to registering the device even tho it may not be properly
> initialized.
>
> Return the wait error so probe fails cleanly when calibration does not
> complete.
After the timeout, the driver checks the status. If the calibration is
not complete, it already returns an error with the appropriate
information. I would expect that error is preferrable to a context-less
"wait eoc timeout".
John Ogness
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: adc: ti-adc12138: fail init on calibration timeout
2026-06-15 12:12 ` John Ogness
@ 2026-06-16 10:14 ` Prashant Rahul
0 siblings, 0 replies; 4+ messages in thread
From: Prashant Rahul @ 2026-06-16 10:14 UTC (permalink / raw)
To: John Ogness, Prashant Rahul, Jonathan Cameron, linux-iio
Cc: Shuah Khan, David Lechner, Nuno Sá, Andy Shevchenko,
Petr Mladek, Krzysztof Kozlowski, Oleg Nesterov, linux-kernel
On Mon Jun 15, 2026 at 5:42 PM IST, John Ogness wrote:
> After the timeout, the driver checks the status. If the calibration is
> not complete, it already returns an error with the appropriate
> information. I would expect that error is preferrable to a context-less
> "wait eoc timeout".
I agree with you. Apologies for not realising that earlier. Thank you for pointing it you.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: adc: ti-adc12138: fail init on calibration timeout
2026-06-15 11:09 [PATCH] iio: adc: ti-adc12138: fail init on calibration timeout Prashant Rahul
2026-06-15 12:12 ` John Ogness
@ 2026-06-15 13:54 ` Andy Shevchenko
1 sibling, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2026-06-15 13:54 UTC (permalink / raw)
To: Prashant Rahul
Cc: Jonathan Cameron, linux-iio, Shuah Khan, David Lechner,
Nuno Sá, Andy Shevchenko, Petr Mladek, Krzysztof Kozlowski,
John Ogness, Oleg Nesterov, linux-kernel
On Mon, Jun 15, 2026 at 04:39:13PM +0530, Prashant Rahul wrote:
> adc12138_init() starts device calibration and waits for the EOC
> interrupt before checking the calibration status. The wait helper
> returns -ETIMEDOUT if the interrupt does not arrive in time, but the
> init path ignores the error and continues probing the device. This could
> lead to registering the device even tho it may not be properly
> initialized.
>
> Return the wait error so probe fails cleanly when calibration does not
> complete.
...
> + ret = adc12138_wait_eoc(adc, msecs_to_jiffies(100));
> + if (ret) {
> + dev_warn(&adc->spi->dev, "wait eoc timeout\n");
> + return ret;
return dev_warn_probe(...);
> + }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-16 10:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-15 11:09 [PATCH] iio: adc: ti-adc12138: fail init on calibration timeout Prashant Rahul
2026-06-15 12:12 ` John Ogness
2026-06-16 10:14 ` Prashant Rahul
2026-06-15 13:54 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox