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

From: Andy Shevchenko

Date: Mon May 11 2026 - 06:49:44 EST


On Sun, May 10, 2026 at 04:24:28PM -0500, Maxwell Doose wrote:
> Replace manual mutex_lock() and mutex_unlock() calls with the much newer
> guard(mutex)() and scoped_guard() macros to enable RAII patterns,
> modernize the driver, and to increase readability.

> Add new wrapper sps30_do_meas() for cleaner locking, and rename existing
> sps30_do_meas() to __sps30_do_meas() to denote locking requirements.

Ah, I was under impression that this is (unlocked version) is used somewhere
else. Since it's not the case, the wrapper is not needed, just use guard()()
in the original code.

--
With Best Regards,
Andy Shevchenko