Re: [PATCH v5 3/3] iio: adc: Add Nuvoton MA35D1 EADC driver
From: Jonathan Cameron
Date: Sat Nov 28 2026 - 19:17:41 EST
> > > + if (!iio_buffer_enabled(indio_dev))
> > > + return 0;
> >
> > As above, I'm missing why we need to protect the call
> > to resume_triggering. The pollfunc can't change between
> > suspend and resume so there is either one there or not
> > in both cases and the guards inside that call should take care
> > of the rest. If I'm missing something we should look to
> > fix it in those calls!
>
> Agreed. The same uninitialized IRQ concern applies to the resume helper.
>
> I also noticed that iio_trigger_attach_poll_func() does not clear
> pf->irq on its error paths. If request_threaded_irq() or
> set_trigger_state() fails, pf->irq can retain a stale positive IRQ
> number after the resources have been released. The normal detach path
> explicitly resets it to 0.
>
> The error propagation from iio_trigger_get_irq() was fixed by
> dff701806ab6, but these two IRQ state issues remain in v7.4-rc4.
>
> Would it make sense to initialize pf->irq to 0 in iio_alloc_pollfunc()
> and clear it on the attach error paths?
Perfect. I'd written exactly that above before reading down to here.
Thanks,
Jonathan
>
> I agree that fixing this in the IIO core would be preferable to relying
> on driver-specific checks. I haven't reproduced an IRQ failure at
> runtime; these findings are based on source inspection.
>
> Thanks,
> Chi-Wen
>