Re: [PATCH v4] iio: chemical: sps30: Replace manual locking with RAII locking

From: Maxwell Doose

Date: Wed May 20 2026 - 15:57:09 EST


On Wed, May 20, 2026 at 7:22 AM Stepan Ionichev <sozdayvek@xxxxxxxxx> 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.

best regards,
max