Re: [PATCH 2/3] iio: light: vl6180: Added Interrupt support for single shot access

From: Abhash jha
Date: Sat Oct 05 2024 - 13:35:47 EST


> > + if (client->irq) {
> > + reinit_completion(&data->completion);
>
> That's late so there is a race condition. You might be delayed just before this
> and finish the measurement before the reint_completion() in which case you'll
> clear the complete() that happens in the interrupt handler before
> then waiting on it.
Yes this makes sense.

> This reinit needs to be before whatever can potentially trigger
> that interrupt.
Can you explain this part, because where can i reinit it, The measurement
starts when we write the START_STOP bit to SYSRANGE_START. So should
it be before that.
I'm kind of confused with this.

Thank you,
Abhash