RE: [PATCH v5 3/4] iio: adc: ad4691: add triggered buffer support

From: Sabau, Radu bogdan

Date: Mon Mar 30 2026 - 05:42:11 EST




> -----Original Message-----
> From: Nuno Sá <noname.nuno@xxxxxxxxx>
> Sent: Saturday, March 28, 2026 11:44 AM
> To: Sabau, Radu bogdan <Radu.Sabau@xxxxxxxxxx>; Lars-Peter Clausen

...

);
> >
> > - return 0;
> > + if (st->manual_mode)
> > + return 0;
> > +
> > + for (gp_num = 0; gp_num < ARRAY_SIZE(ad4691_gp_names);
> gp_num++) {
> > + if (fwnode_irq_get_byname(dev_fwnode(dev),
> > +   ad4691_gp_names[gp_num]) > 0)
>
> Don't love this line break. I'm also a bit puzzled. How does the above differs
> from
> the trigger code? I guess this should be the same GP pin?
>
>

Hi Nuno,

You are right - both loops scan ad4691_gp_names[] independently and must
agree by construction, which is fragile. While gpio_setup() needs to happen,
there is no reason for it to live on ad4691_config(), since setup_triggered_buffer
is only called for the non-offload path and already iterates gp_names[] to find
the IRQ. So we can call gpio_setup right there and frop the lookup from
ad4691_config() entirely, and no need for those early returns either.

Thanks,
Radu