From: Joshua Crofts <joshua.crofts1@gmail.com>
To: Erick Henrique <erick.henrique.rodrigues@usp.br>
Cc: jic23@kernel.org, andriy.shevchenko@intel.com, andy@kernel.org,
dlechner@baylibre.com, nuno.sa@analog.com,
linux-iio@vger.kernel.org
Subject: Re: [PATCH v4 3/3] iio: dac: m62332: Use guard(mutex) for locking
Date: Sat, 27 Jun 2026 19:44:52 +0200 [thread overview]
Message-ID: <20260627194452.124793fd@systembl0wer> (raw)
In-Reply-To: <20260627132530.96680-4-erick.henrique.rodrigues@usp.br>
On Sat, 27 Jun 2026 10:25:30 -0300
Erick Henrique <erick.henrique.rodrigues@usp.br> wrote:
> Replace mutex_lock()/mutex_unlock() calls with guard(mutex)() to
> simplify locking and make cleanup automatic when the lock goes out
> of scope. Also simplify the i2c_master_send() error handling by
> using sequential early returns instead of a combined condition.
>
> Signed-off-by: Erick Henrique <erick.henrique.rodrigues@usp.br>
> ---
> drivers/iio/dac/m62332.c | 17 +++++------------
> 1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/iio/dac/m62332.c b/drivers/iio/dac/m62332.c
> index ee8fd3a71315..10ff6727b76c 100644
> --- a/drivers/iio/dac/m62332.c
> +++ b/drivers/iio/dac/m62332.c
> @@ -47,33 +47,26 @@ static int m62332_set_value(struct iio_dev *indio_dev, u8 val, int channel)
> outbuf[0] = channel;
> outbuf[1] = val;
>
> - mutex_lock(&data->mutex);
> + guard(mutex)(&data->mutex);
You're missing #include <linux/cleanup.h>.
--
Kind regards
CJD
prev parent reply other threads:[~2026-06-27 17:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-27 13:25 [PATCH v4 0/3] iio: dac: m62332: header cleanup and guard(mutex) Erick Henrique
2026-06-27 13:25 ` [PATCH v4 1/3] iio: dac: m62332: Sort header includes alphabetically Erick Henrique
2026-06-27 17:34 ` Joshua Crofts
2026-06-27 13:25 ` [PATCH v4 2/3] iio: dac: m62332: Clean up header includes Erick Henrique
2026-06-27 17:40 ` Joshua Crofts
2026-06-27 13:25 ` [PATCH v4 3/3] iio: dac: m62332: Use guard(mutex) for locking Erick Henrique
2026-06-27 17:44 ` Joshua Crofts [this message]
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=20260627194452.124793fd@systembl0wer \
--to=joshua.crofts1@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=erick.henrique.rodrigues@usp.br \
--cc=jic23@kernel.org \
--cc=linux-iio@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