[PATCH 2/4] iio: magnetometer: rm3100: Use scoped_guard() in rm3100_get_samp_freq()
From: Maxwell Doose
Date: Mon Apr 27 2026 - 22:45:05 EST
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.
Signed-off-by: Maxwell Doose <m32285159@xxxxxxxxx>
---
drivers/iio/magnetometer/rm3100-core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/magnetometer/rm3100-core.c b/drivers/iio/magnetometer/rm3100-core.c
index a2bf6e504a15..76824dcb1b73 100644
--- a/drivers/iio/magnetometer/rm3100-core.c
+++ b/drivers/iio/magnetometer/rm3100-core.c
@@ -280,9 +280,9 @@ static int rm3100_get_samp_freq(struct rm3100_data *data, int *val, int *val2)
unsigned int tmp;
int ret;
- 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);
+ }
if (ret < 0)
return ret;
*val = rm3100_samp_rates[tmp - RM3100_TMRC_OFFSET][0];
--
2.53.0