mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ti-ads1119: Reinit completion before wait_for_completion_timeout()
@ 2026-03-02 16:48 Felix Gu
  2026-03-02 19:54 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Gu @ 2026-03-02 16:48 UTC (permalink / raw)
  To: Francesco Dolcini, João Paulo Gonçalves,
	Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko
  Cc: Jonathan Cameron, João Paulo Gonçalves,
	Francesco Dolcini, linux-iio, linux-kernel, Felix Gu

The completion is not reinit before wait_for_completion_timeout(),
so wait_for_completion_timeout() will return immediately after
the first successful completion.

Fixes: a9306887eba4 ("iio: adc: ti-ads1119: Add driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/iio/adc/ti-ads1119.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/adc/ti-ads1119.c b/drivers/iio/adc/ti-ads1119.c
index c9cedc59cdcd..75dbb469fa27 100644
--- a/drivers/iio/adc/ti-ads1119.c
+++ b/drivers/iio/adc/ti-ads1119.c
@@ -276,6 +276,9 @@ static int ads1119_single_conversion(struct ads1119_state *st,
 	if (ret)
 		goto pdown;
 
+	if (st->client->irq)
+		reinit_completion(&st->completion);
+
 	ret = ads1119_configure_channel(st, mux, gain, datarate);
 	if (ret)
 		goto pdown;

---
base-commit: 3fa5e5702a82d259897bd7e209469bc06368bf31
change-id: 20260303-ti-ads1119-1-cc68e3c01783

Best regards,
-- 
Felix Gu <ustc.gu@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ti-ads1119: Reinit completion before wait_for_completion_timeout()
  2026-03-02 16:48 [PATCH] iio: adc: ti-ads1119: Reinit completion before wait_for_completion_timeout() Felix Gu
@ 2026-03-02 19:54 ` Jonathan Cameron
  2026-03-03 13:26   ` Felix Gu
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2026-03-02 19:54 UTC (permalink / raw)
  To: Felix Gu
  Cc: Francesco Dolcini, João Paulo Gonçalves, David Lechner,
	Nuno Sá,
	Andy Shevchenko, Jonathan Cameron,
	João Paulo Gonçalves, Francesco Dolcini, linux-iio,
	linux-kernel

On Tue, 03 Mar 2026 00:48:45 +0800
Felix Gu <ustc.gu@gmail.com> wrote:

> The completion is not reinit before wait_for_completion_timeout(),
> so wait_for_completion_timeout() will return immediately after
> the first successful completion.
> 
> Fixes: a9306887eba4 ("iio: adc: ti-ads1119: Add driver")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
I agree there is a bug here but a question inline.
> ---
>  drivers/iio/adc/ti-ads1119.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/iio/adc/ti-ads1119.c b/drivers/iio/adc/ti-ads1119.c
> index c9cedc59cdcd..75dbb469fa27 100644
> --- a/drivers/iio/adc/ti-ads1119.c
> +++ b/drivers/iio/adc/ti-ads1119.c
> @@ -276,6 +276,9 @@ static int ads1119_single_conversion(struct ads1119_state *st,
>  	if (ret)
>  		goto pdown;
>  
> +	if (st->client->irq)
> +		reinit_completion(&st->completion);
> +
What's the reason for doing here rather than a few lines later.
That is before this
ret = i2c_smbus_write_byte(st->client, ADS1119_CMD_START_SYNC);
which the  naming suggests kicks of the actual channel capture?

Jonathan

>  	ret = ads1119_configure_channel(st, mux, gain, datarate);
>  	if (ret)
>  		goto pdown;
> 
> ---
> base-commit: 3fa5e5702a82d259897bd7e209469bc06368bf31
> change-id: 20260303-ti-ads1119-1-cc68e3c01783
> 
> Best regards,


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ti-ads1119: Reinit completion before wait_for_completion_timeout()
  2026-03-02 19:54 ` Jonathan Cameron
@ 2026-03-03 13:26   ` Felix Gu
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Gu @ 2026-03-03 13:26 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Francesco Dolcini, João Paulo Gonçalves, David Lechner,
	Nuno Sá,
	Andy Shevchenko, Jonathan Cameron,
	João Paulo Gonçalves, Francesco Dolcini, linux-iio,
	linux-kernel

> What's the reason for doing here rather than a few lines later.
> That is before this
> ret = i2c_smbus_write_byte(st->client, ADS1119_CMD_START_SYNC);
> which the  naming suggests kicks of the actual channel capture?
>
> Jonathan
>
Hi Jonathan,

I think both positions are fine, but the one you mentioned is more precise.
I will update it in V2.

Best regards,
Felix

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-03 13:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-02 16:48 [PATCH] iio: adc: ti-ads1119: Reinit completion before wait_for_completion_timeout() Felix Gu
2026-03-02 19:54 ` Jonathan Cameron
2026-03-03 13:26   ` Felix Gu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®