From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Maxwell Doose <m32285159@gmail.com>
Cc: songqiang1304521@gmail.com, jic23@kernel.org,
dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] iio: magnetometer: rm3100: Use scoped_guard() in rm3100_read_mag()
Date: Tue, 28 Apr 2026 11:27:32 +0300 [thread overview]
Message-ID: <afBvdGstR5aIAmxg@ashevche-desk.local> (raw)
In-Reply-To: <20260428024339.45109-2-m32285159@gmail.com>
On Mon, Apr 27, 2026 at 09:43:36PM -0500, Maxwell Doose wrote:
> Replace mutex_lock() and mutex_unlock() calls in rm3100_read_mag() with
> the more modern scoped_guard(). This will help modernize the driver and
> bring it up-to-date with modern available macros/functions.
>
> While at it, remove the now unnecessary "unlock_return" goto and
> directly return in if statements.
...
> + scoped_guard(mutex, &data->lock) {
> + }
While this is strictly correct change, I would prefer to see guard()() for the
sake of less unneeded noise in the change.
> *val = sign_extend32(get_unaligned_be24(&buffer[0]), 23);
Yep, this will become part of the critical section, but taking into account
the size of the rest (and how much CPU cycles it might take at run-time)
I do not believe this piece of memory access with sign extension algo will
anyhow affect the duration of execution of the critical section.
> return IIO_VAL_INT;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-04-28 8:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 2:43 [PATCH 0/4] iio: magnetometer: rm3100: Modernize locking and control flow Maxwell Doose
2026-04-28 2:43 ` [PATCH 1/4] iio: magnetometer: rm3100: Use scoped_guard() in rm3100_read_mag() Maxwell Doose
2026-04-28 8:27 ` Andy Shevchenko [this message]
2026-04-28 2:43 ` [PATCH 2/4] iio: magnetometer: rm3100: Use scoped_guard() in rm3100_get_samp_freq() Maxwell Doose
2026-04-28 8:24 ` Andy Shevchenko
2026-04-28 2:43 ` [PATCH 3/4] iio: magnetometer: rm3100: Use guard(mutex)() in rm3100_set_samp_freq() Maxwell Doose
2026-04-28 8:28 ` Andy Shevchenko
2026-04-28 11:18 ` Maxwell Doose
2026-04-28 2:43 ` [PATCH 4/4] iio: magnetometer: rm3100: Use scoped_guard in rm3100_trigger_handler() Maxwell Doose
2026-04-28 10:05 ` Andy Shevchenko
2026-04-28 11:17 ` Maxwell Doose
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=afBvdGstR5aIAmxg@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