RE: [PATCH v9 3/6] iio: adc: ad4691: add triggered buffer support

From: Sabau, Radu bogdan

Date: Mon May 04 2026 - 08:07:00 EST


Hi Andy,

> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
> Sent: Monday, May 4, 2026 10:58 AM
> To: Sabau, Radu bogdan <Radu.Sabau@xxxxxxxxxx>
> Cc: Lars-Peter Clausen <lars@xxxxxxxxxx>; Hennerich, Michael
> <Michael.Hennerich@xxxxxxxxxx>; Jonathan Cameron <jic23@xxxxxxxxxx>;
> David Lechner <dlechner@xxxxxxxxxxxx>; Sa, Nuno <Nuno.Sa@xxxxxxxxxx>;
> Andy Shevchenko <andy@xxxxxxxxxx>; Rob Herring <robh@xxxxxxxxxx>;

...

> > + /*
> > + * CNV burst: 16 AVG_IN addresses + state-reset address + state-reset
> > + * value = 18. Manual: 16 channel cmds + 1 NOOP = 17.
> > + */
> > + __be16 scan_tx[18] __aligned(IIO_DMA_MINALIGN);
> > + /*
> > + * Scan buffer: one BE16 slot per active channel, plus timestamp.
> > + * DMA-aligned because scan_xfers point rx_buf directly into vals[].
> > + */
> > + IIO_DECLARE_DMA_BUFFER_WITH_TS(__be16, vals, 16);
>
> Have you run `pahole`? I'm wondering if this aligned member can be coupled
> with
> something that gives lesser gap.
>

Yep, I ran pahole, and this was my concern as well at first. The holes are forced because
of DMA alignment used by this MACRO so although I tried reordering or coupling it with
something else, it doesn't seem to eliminate the holes.

>
> > +static ssize_t sampling_frequency_store(struct device *dev,
> > + struct device_attribute *attr,
> > + const char *buf, size_t len)

...

> > + for (i = 0; i < ARRAY_SIZE(ad4691_gp_names); i++) {
> > + irq = fwnode_irq_get_byname(dev_fwnode(dev),
> > + ad4691_gp_names[i]);
> > + if (irq > 0)
> > + break;
>
> This is problematic in case the above returns EPROBE_DEFER. Can you confirm
> it
> may not ever happen? (Note, I don't know the answer.)
>

You are right, thanks for this!