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

Sabau, Radu bogdan
2026-05-04T12:06:21Z

Hi Andy,

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

...

> > + /*
> > + * 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!