From: Jonathan Cameron <jic23@kernel.org>
To: Andrew Ijano <andrew.ijano@gmail.com>
Cc: andrew.lopes@alumni.usp.br, gustavobastos@usp.br,
dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
jstephan@baylibre.com, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 3/3] iio: accel: sca3000: use guard(mutex)() for handling mutex lock
Date: Sat, 14 Jun 2025 13:01:32 +0100 [thread overview]
Message-ID: <20250614130132.220f5f16@jic23-huawei> (raw)
In-Reply-To: <20250611194648.18133-4-andrew.lopes@alumni.usp.br>
On Wed, 11 Jun 2025 16:39:21 -0300
Andrew Ijano <andrew.ijano@gmail.com> wrote:
> Use guard(mutex)(&st->lock) for handling mutex lock instead of
> manually locking and unlocking the mutex. This prevents forgotten
> locks due to early exits and remove the need of gotos.
>
> Signed-off-by: Andrew Ijano <andrew.lopes@alumni.usp.br>
> Co-developed-by: Gustavo Bastos <gustavobastos@usp.br>
> Signed-off-by: Gustavo Bastos <gustavobastos@usp.br>
> Suggested-by: Jonathan Cameron <jic23@kernel.org>
> ---
> For this one, there are two cases where the previous implementation
> was a smalllocking portion of the code and now it's locking the whole
> function. I don't know if this is a desired behavior.
I'd call out more specifically that you are going from
lock
stuff
unlock
call which contains lock over whole useful scope
to
lock
stuff
call with lock no longer done inside
unlock
In at least one case. Looks cleaner to me. I'd guess this is a silly
bit of code evolution that you are tidying up as that lock dance looks
pointless to me.
Otherwise just the {} for cases thing needs fixing up.
Jonathan
next prev parent reply other threads:[~2025-06-14 12:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 19:39 [PATCH v5 0/3] iio: accel: sca3000: simplify by using newer infrastructure Andrew Ijano
2025-06-11 19:39 ` [PATCH v5 1/3] iio: accel: sca3000: replace error_ret labels by simple returns Andrew Ijano
2025-06-12 6:20 ` Nuno Sá
2025-06-12 6:41 ` Nuno Sá
2025-06-14 19:12 ` Andrew Ijano
2025-06-12 12:56 ` Andy Shevchenko
2025-06-14 11:48 ` Jonathan Cameron
2025-06-14 19:16 ` Andrew Ijano
2025-06-11 19:39 ` [PATCH v5 2/3] iio: accel: sca3000: replace usages of internal read data helpers by spi helpers Andrew Ijano
2025-06-12 6:29 ` Nuno Sá
2025-06-14 19:33 ` Andrew Ijano
2025-06-18 2:36 ` Andrew Ijano
2025-06-12 13:22 ` Andy Shevchenko
2025-06-14 21:06 ` Andrew Ijano
2025-06-14 21:50 ` Andy Shevchenko
2025-06-15 3:21 ` Andrew Ijano
2025-06-11 19:39 ` [PATCH v5 3/3] iio: accel: sca3000: use guard(mutex)() for handling mutex lock Andrew Ijano
2025-06-12 6:38 ` Nuno Sá
2025-06-14 11:54 ` Jonathan Cameron
2025-06-14 21:17 ` Andrew Ijano
2025-06-12 14:48 ` kernel test robot
2025-06-12 15:52 ` kernel test robot
2025-06-12 16:06 ` David Lechner
2025-06-14 21:21 ` Andrew Ijano
2025-06-14 12:01 ` Jonathan Cameron [this message]
2025-06-14 21:40 ` Andrew Ijano
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=20250614130132.220f5f16@jic23-huawei \
--to=jic23@kernel.org \
--cc=andrew.ijano@gmail.com \
--cc=andrew.lopes@alumni.usp.br \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=gustavobastos@usp.br \
--cc=jstephan@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.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;
as well as URLs for NNTP newsgroup(s).