Re: [PATCH v2 6/7] iio: adc: ti-ads1262: Add buffer and trigger support

From: Jonathan Cameron

Date: Mon Jun 29 2026 - 20:54:37 EST


On Sun, 28 Jun 2026 00:36:07 -0500
Kurt Borja <kuurtb@xxxxxxxxx> wrote:

> Add triggered buffer support and a data-ready (DRDY) hardware trigger.
>
> Signed-off-by: Kurt Borja <kuurtb@xxxxxxxxx>


> +static irqreturn_t ads1262_trigger_handler(int irq, void *p)
> +{
> + struct iio_poll_func *pf = p;
> + struct iio_dev *indio_dev = pf->indio_dev;
> + struct ads1262 *st = iio_priv(indio_dev);
> + s64 ts = pf->timestamp;
> + unsigned int weight;
> + int ret;
> +
> + weight = bitmap_weight(indio_dev->active_scan_mask,
> + iio_get_masklength(indio_dev));
> +
> + memset(st->scan_buffer, 0, sizeof(st->scan_buffer));

We don't normally care about stale data in scan_buffers. The only
thing to be careful of is any stack or heap data leakage (I don't
see any of that here) So is this clear needed?

Userspace should know which bits are valid and extract them,
thus ignoring anything stale in the gaps.

> +
> + if (weight == 1)
> + ret = ads1262_fill_buffer_one(st);
> + else
> + ret = ads1262_fill_buffer_mult(st);
> + if (ret)
> + goto out_notify_done;
> +
> + iio_push_to_buffers_with_ts(indio_dev, st->scan_buffer,
> + sizeof(st->scan_buffer), ts);
> +
> +out_notify_done:
> + iio_trigger_notify_done(indio_dev->trig);
> +
> + return IRQ_HANDLED;
> +}