Re: [PATCH v2] iio: chemical: scd30: Replace manual locking with RAII locking

From: Maxwell Doose

Date: Tue May 19 2026 - 17:52:12 EST


On Tue, May 19, 2026 at 8:41 AM Joshua Crofts <joshua.crofts1@xxxxxxxxx> wrote:
>
> On Tue, 19 May 2026 at 15:28, Maxwell Doose <m32285159@xxxxxxxxx> wrote:
> >
> > scd30_core.c currently uses manual mutex_lock() and mutex_unlock()
> > calls. Replace them with the newer guard(mutex)() for cleaner RAII
> > patterns and to improve maintainability.
> >
> > Add new helper function scd30_trigger_handler_helper_locked() containing
> > the critical section for scd30_trigger_handler().
> >
> > In addition, small refactor to replace "?:" operator with regular
> > if/else returns.
> >
> > Signed-off-by: Maxwell Doose <m32285159@xxxxxxxxx>
> > ---
>
> LGTM, Sashiko also seems to be alright with it.
>
> On another note - this driver sure needs cleaning up.
>

Agreed. I've stated previously that it may be a good idea to get some
newer kernel devs in here since there's a lot of things worth patching
in here (when I say newer kernel devs, I don't mean the absolute
beginners. should've at least submitted a patch in staging).

best regards,
max
> Reviewed-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
>
> --
> Kind regards
>
> CJD