[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <24ab3315-8f83-4d52-b6be-abd31e58d0c8@vaisala.com>
Date: Fri, 23 Jan 2026 09:10:20 +0200
From: Tomas Melin <tomas.melin@...sala.com>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Michael Hennerich <Michael.Hennerich@...log.com>,
Nuno Sa <nuno.sa@...log.com>, Lars-Peter Clausen <lars@...afoo.de>,
Jonathan Cameron <jic23@...nel.org>, David Lechner <dlechner@...libre.com>,
Andy Shevchenko <andy@...nel.org>,
Olivier Moysan <olivier.moysan@...s.st.com>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 4/4] iio: adc: ad9467: check for backend capabilities
Hi,
On 21/01/2026 14:58, Andy Shevchenko wrote:
> 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.
I have no strong opinion on this. Current option was chosen as it seemed
cleaner in the sense that it a) takes the mutex only when needed and b)
check for caps does not require the mutex to be held. Based on this I
still suggest keeping as is but will change if you insist.
Thanks,
Tomas
>
>> - 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;
>> }
>
Powered by blists - more mailing lists