From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Tomas Melin <tomas.melin@vaisala.com>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>,
Nuno Sa <nuno.sa@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Jonathan Cameron <jic23@kernel.org>,
David Lechner <dlechner@baylibre.com>,
Andy Shevchenko <andy@kernel.org>,
Olivier Moysan <olivier.moysan@foss.st.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 4/4] iio: adc: ad9467: check for backend capabilities
Date: Fri, 23 Jan 2026 10:18:48 +0200 [thread overview]
Message-ID: <aXMu6DMwRXjsjk6J@smile.fi.intel.com> (raw)
In-Reply-To: <24ab3315-8f83-4d52-b6be-abd31e58d0c8@vaisala.com>
On Fri, Jan 23, 2026 at 09:10:20AM +0200, Tomas Melin wrote:
> On 21/01/2026 14:58, Andy Shevchenko wrote:
> > On Wed, Jan 21, 2026 at 12:08:33PM +0000, Tomas Melin wrote:
...
> >> 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.
If you want your way, do not use guard()(). guard()() inside branches is
unintuitive and not the common way of doing it. Most likely you wanted
scoped_guard(). So, to me, guard() indented to more than 1 tab is suspicious
(I don't say it's forbidden or wrong).
> >> - 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
next prev parent reply other threads:[~2026-01-23 8:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 12:08 [PATCH v4 0/4] iio: adc: ad9467: Support alternative backends Tomas Melin
2026-01-21 12:08 ` [PATCH v4 1/4] iio: industrialio-backend: support backend capabilities Tomas Melin
2026-01-22 20:43 ` Jonathan Cameron
2026-01-23 5:38 ` Tomas Melin
2026-01-21 12:08 ` [PATCH v4 2/4] iio: adc: adi-axi-adc: define supported iio-backend capabilities Tomas Melin
2026-01-21 12:08 ` [PATCH v4 3/4] iio: adc: adi-axi-dac: " Tomas Melin
2026-01-22 20:44 ` Jonathan Cameron
2026-01-21 12:08 ` [PATCH v4 4/4] iio: adc: ad9467: check for backend capabilities Tomas Melin
2026-01-21 12:58 ` Andy Shevchenko
2026-01-23 7:10 ` Tomas Melin
2026-01-23 8:18 ` Andy Shevchenko [this message]
2026-01-22 20:38 ` [PATCH v4 0/4] iio: adc: ad9467: Support alternative backends Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aXMu6DMwRXjsjk6J@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=olivier.moysan@foss.st.com \
--cc=tomas.melin@vaisala.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox