Re: [PATCH 2/4] iio: magnetometer: rm3100: Use scoped_guard() in rm3100_get_samp_freq()
From: Andy Shevchenko
Date: Tue Apr 28 2026 - 04:29:47 EST
On Mon, Apr 27, 2026 at 09:43:37PM -0500, Maxwell Doose wrote:
> Replace mutex_lock() and mutex_unlock() calls in rm3100_get_samp_freq()
> with the more modern scoped_guard(). This will help modernize the
> driver and bring it up-to-date with modern available macros/functions.
...
> - mutex_lock(&data->lock);
> - ret = regmap_read(data->regmap, RM3100_REG_TMRC, &tmp);
> - mutex_unlock(&data->lock);
> + scoped_guard(mutex, &data->lock) {
> + ret = regmap_read(data->regmap, RM3100_REG_TMRC, &tmp);
> + }
{} are mot used for the single statement, but...
> if (ret < 0)
> return ret;
...move this inside the body instead.
--
With Best Regards,
Andy Shevchenko