From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Maxwell Doose <m32285159@gmail.com>
Cc: songqiang1304521@gmail.com, jic23@kernel.org,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"open list:PNI RM3100 IIO DRIVER" <linux-iio@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5] iio: magnetometer: rm3100: Modernize locking and refactor control flow
Date: Thu, 30 Apr 2026 15:57:56 +0300 [thread overview]
Message-ID: <afNR1Apx86FeAcKd@ashevche-desk.local> (raw)
In-Reply-To: <20260430124148.11572-1-m32285159@gmail.com>
On Thu, Apr 30, 2026 at 07:41:47AM -0500, Maxwell Doose wrote:
> Replace mutex_lock() and mutex_unlock() calls in rm3100-core.c with
> the more modern guard(mutex)() family. This will help modernize the
> driver and bring it up-to-date with modern available macros/functions.
>
> While replacing mutex_lock() and mutex_unlock(), the critical sections
> of rm3100_read_mag() and rm3100_get_samp_freq() have been extended to
> include negligible operations for cleaner logic.
>
> Add new helper-wrapper function rm3100_guarded_regmap_bulk_read() to
> help keep rm3100_trigger_handler() switch-cases clean while maintaining
> mutex locking and avoiding re-entrancy risks from potential callbacks.
>
> While at it, remove redundant gotos where applicable, and use direct
> returns instead. In addition, remove regmap variable in
> rm3100_trigger_handler() as its references have been replaced with
> variable data.
...
> + ret = rm3100_regmap_bulk_read_locked(data, RM3100_REG_MX2 + 3 * bit,
> + data->buffer, 3);
Jonathan, if you feel to tweak this to make it shorter, I mentioned previously
this:
ret = rm3100_regmap_bulk_read_locked(data,
RM3100_REG_MX2 + 3 * bit,
data->buffer, 3);
> + if (ret < 0)
> goto done;
I confirm that my Rb stays with or without this change.
Maxwell, no need to resend for this.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-04-30 12:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 12:41 [PATCH v5] iio: magnetometer: rm3100: Modernize locking and refactor control flow Maxwell Doose
2026-04-30 12:45 ` Maxwell Doose
2026-04-30 12:57 ` Andy Shevchenko [this message]
2026-04-30 15:43 ` Maxwell Doose
2026-05-05 12:45 ` Jonathan Cameron
2026-05-05 17:05 ` Maxwell Doose
2026-05-06 14:43 ` Jonathan Cameron
2026-05-06 15:28 ` Maxwell Doose
2026-05-06 18:31 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=afNR1Apx86FeAcKd@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m32285159@gmail.com \
--cc=nuno.sa@analog.com \
--cc=songqiang1304521@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox