From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: raffaele.tranfaglia@gmail.com
Cc: "Nuno Sá" <nuno.sa@analog.com>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux@analog.com, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: light: adux1020: use guard() to simplify lock handling
Date: Mon, 9 Nov 2026 21:58:56 +0200 [thread overview]
Message-ID: <avImAIJxoTQJOWzf@ashevche-desk.local> (raw)
In-Reply-To: <20261108-adux1020-guard-v1-1-db9c582f1eea@gmail.com>
On Sun, Nov 08, 2026 at 08:16:13PM +0000, Raffaele Tranfaglia via B4 Relay wrote:
>
> Use guard(mutex) in adux1020_read_raw(), adux1020_write_raw() and
> adux1020_write_event_config() so the lock is released automatically on
> return. This allows returning directly instead of jumping to a common
> unlock label, and lets adux1020_write_raw() drop its ret variable.
>
> No functional change intended.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
...
> Suggested-by: Jonathan Cameron <jic23@kernel.org>
> Link: https://lore.kernel.org/all/20261107222957.5332237b@jic23-hlaptop/
It's not recommended to put unreferenced Link tags.
...
> static int adux1020_read_raw(struct iio_dev *indio_dev,
> {
> struct adux1020_data *data = iio_priv(indio_dev);
> u16 buf[3];
> - int ret = -EINVAL;
> + int ret;
> unsigned int regval;
While at it you can move 'ret' to be the last in the definition block.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-11-09 19:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 20:16 [PATCH] iio: light: adux1020: use guard() to simplify lock handling Raffaele Tranfaglia
2026-11-08 20:16 ` Raffaele Tranfaglia via B4 Relay
2026-11-09 9:34 ` Joshua Crofts
2026-11-09 19:58 ` Andy Shevchenko [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=avImAIJxoTQJOWzf@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.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=linux@analog.com \
--cc=nuno.sa@analog.com \
--cc=raffaele.tranfaglia@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.