Re: [PATCH 06/35] iio: adc: ad7768-1: use default_trigger

From: Jonathan Cameron

Date: Sun Nov 22 2026 - 14:41:13 EST


On Wed, 18 Nov 2026 09:44:29 +0100
Joshua Crofts <crofts@xxxxxxxxxx> wrote:

> On Mon, 16 Nov 2026 01:47:54 +0000
> Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> > From: Jonathan Cameron <jonathan.cameron@xxxxxxxxxxxxxxxx>
> >
> > Set indio_dev->default_trigger rather than taking a reference to the
> > trigger in probe(). The IIO core now takes the reference during
> > iio_device_register(), so it is not leaked if probe() fails after
> > the trigger is set up. This avoids fragile ordering requirements
> > in probe().
> >
> > Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support")
>
> Sashiko points out the Fixes tag is probably incorrect (and I agree). Commit a5f8c7da3dbe
> set indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_TRIGGERED, which guaranteed
> trigger unregistering on driver exit (I checked and it does this by bitwise & with the
> INDIO_ALL_TRIGGERED_MODE). This behaviour was then removed with:
>
> bca036de0ab2 ("iio: adc: ad778-1: do not explicity set INDIO_BUFFER_TRIGGERED mode")
>
ah. That is indeed subtle but correct. The flag should never have been
set but coincidentally was set early enough that the ordering meant
the bug we are fixing here wasn't exposed until after that.

Tweaked whilst applying.