Re: [PATCH v4 4/4] iio: adc: ad9467: check for backend capabilities

From: Andy Shevchenko

Date: Wed Jan 21 2026 - 08:11:59 EST


On Wed, Jan 21, 2026 at 12:08:33PM +0000, Tomas Melin wrote:
> Add capability checks for operation with backends that do not necessarily
> support full set of features, but are otherwise compatible with the device.
> This ensures a fully functional device, but with limited capabilities.

...

> static int __ad9467_update_clock(struct ad9467_state *st, long r_clk)

> if (ret)
> return ret;
>
> - guard(mutex)(&st->lock);

I would leave this as is. Yes, practically we don't need to cover
iio_backend_has_caps() with mutex to access the data, but it just makes code
slightly more maintainable in my opinion. If anything appears here, it would
probably mean some kind of if (...) do_blablabla(...); pattern that will need
a mutex.

> - return ad9467_calibrate(st);
> + if (iio_backend_has_caps(st->back, IIO_BACKEND_CAP_CALIBRATION)) {
> + guard(mutex)(&st->lock);
> + return ad9467_calibrate(st);
> + }
> + return 0;
> }

--
With Best Regards,
Andy Shevchenko