From: Jonathan Cameron <jic23@kernel.org>
To: Maxwell Doose <m32285159@gmail.com>
Cc: Stepan Ionichev <sozdayvek@gmail.com>,
tomasz.duszynski@octakon.com, dlechner@baylibre.com,
nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] iio: chemical: sps30: Replace manual locking with RAII locking
Date: Wed, 20 May 2026 20:04:12 +0100 [thread overview]
Message-ID: <20260520200412.32068dcb@jic23-huawei> (raw)
In-Reply-To: <CAKqfh0G43HY9Mt5WW=0evk4Rveh_4hqkMdragdZcd+cQBNGr2g@mail.gmail.com>
On Wed, 20 May 2026 11:49:33 -0500
Maxwell Doose <m32285159@gmail.com> wrote:
> On Wed, May 20, 2026 at 7:22 AM Stepan Ionichev <sozdayvek@gmail.com> wrote:
> >
> > The hunk in sps30_read_raw() adds an empty line before "default:" in
> > the switch, which is unrelated to the RAII conversion and probably
> > worth dropping.
> >
>
> First one is a stray change, my bad.
>
>
> > Also, moving guard(mutex) into sps30_do_meas() changes its contract:
> > previously callers had to hold state->lock around the call, now the
> > function takes it itself. A line in the commit log would help future
> > readers avoid the obvious "I'll just wrap it in mutex_lock()" pitfall.
> >
> > Stepan
>
> See:
> >> Add guard(mutex)() into sps30_do_meas() as every caller locks it's call.
>
> Basic but still denotes that sps30_do_meas() holds the lock.
I'd tweak to something a tiny bit more detailed like
Move mutex locking (and switch to guard()) into sps30_do_meas() as every
caller takes the lock just for this call.
>
> best regards,
> max
>
next prev parent reply other threads:[~2026-05-20 19:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 21:26 [PATCH v4] iio: chemical: sps30: Replace manual locking with RAII locking Maxwell Doose
2026-05-20 12:22 ` Stepan Ionichev
2026-05-20 16:49 ` Maxwell Doose
2026-05-20 19:04 ` Jonathan Cameron [this message]
2026-05-20 20:07 ` Maxwell Doose
2026-06-02 7:13 ` Andy Shevchenko
2026-06-02 11:49 ` 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=20260520200412.32068dcb@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m32285159@gmail.com \
--cc=nuno.sa@analog.com \
--cc=sozdayvek@gmail.com \
--cc=tomasz.duszynski@octakon.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