Re: [PATCH] Fix IRQ issue by setting IRQ_DISABLE_UNLAZY flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Mon, 2023-03-06 at 13:47 +0900, Masahiro Honda wrote:
> ADC using ad7793.ko, such as AD7794, may read incorrect data.
> Extra interrupt is pending if the data on DOUT contains a falling
> edge.
> Therefore, wait_for_completion_timeout returns immediately.
> This patch fixes the issue by setting IRQ_DISABLE_UNLAZY flag.
> Signed-off-by: Masahiro Honda <honda@xxxxxxxxxxxxx>
> ---
>  drivers/iio/adc/ad_sigma_delta.c | 1 +
>  1 file changed, 1 insertion(+)
> diff --git a/drivers/iio/adc/ad_sigma_delta.c
> b/drivers/iio/adc/ad_sigma_delta.c
> index d8570f620..364051809 100644
> --- a/drivers/iio/adc/ad_sigma_delta.c
> +++ b/drivers/iio/adc/ad_sigma_delta.c
> @@ -584,6 +584,7 @@ static int devm_ad_sd_probe_trigger(struct device
> *dev, struct iio_dev *indio_de
>         init_completion(&sigma_delta->completion);
>         sigma_delta->irq_dis = true;
> +       irq_set_status_flags(sigma_delta->spi->irq,

Hmmm this looks to be a very likely issue for any device having to
brute force IRQ disabling by disabling the line (disable_irq()). That
said, I think the commit message can (needs) to be improved. The
message feels a bit confusing to me. Also, having a reference to

commit e9849777d0e2 ("genirq: Add flag to force mask in

would be nice to give some background on why this can be an issue.

Another thing that came to my mind is if the data is totally
garbage/wrong or is it just some outstanding sample?

Some research on this also seems to point that we should (need?) call
irq_clear_status_flags(irq, IRQ_DISABLE_UNLAZY) when freeing the IRQ.

I also wonder if we should keep this out of the library and have a per
device config? Sure, this won't make anything wrong but it will hurt
performance. OTOH, even though no one else ever reported this before,
it looks like this can be an issue for all of the supported sigma delta

- Nuno Sá

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     []

  Powered by Linux