From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Guilherme Dias <guilhermeabreu200105@usp.br>
Cc: lars@metafoo.de, Michael.Hennerich@analog.com,
nish.malpani25@gmail.com, jic23@kernel.org,
dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
"João Paulo Menezes Linaris" <jplinaris@usp.br>,
linux-iio@vger.kernel.org
Subject: Re: [PATCH v3] iio: gyro: adxrs290: Use guard(mutex) in lieu of manual lock+unlock
Date: Wed, 29 Apr 2026 22:59:27 +0300 [thread overview]
Message-ID: <afJjH1Mn_ZqKWN7L@ashevche-desk.local> (raw)
In-Reply-To: <20260429195214.22374-1-guilhermeabreu200105@usp.br>
On Wed, Apr 29, 2026 at 04:51:05PM -0300, Guilherme Dias wrote:
> Use guard(mutex) to automatically release the lock on scope exit,
> simplifying the error handling path and removing the need for
> explicit unlock and goto-based cleanup.
...
> + do {
> + guard(mutex)(&st->lock);
>
> - /* exercise a bulk data capture starting from reg DATAX0... */
> - ret = spi_write_then_read(st->spi, &tx, sizeof(tx), st->buffer.channels,
> - sizeof(st->buffer.channels));
> - if (ret < 0)
> - goto out_unlock_notify;
> + /* exercise a bulk data capture starting from reg DATAX0... */
> + ret = spi_write_then_read(st->spi, &tx, sizeof(tx), st->buffer.channels,
> + sizeof(st->buffer.channels));
Fix the indentation. The (starting) column for the parameters should be
the same. Also the first one goes over 80 limit, wrap that and it's actually
gets better as the split will become more logical.
ret = spi_write_then_read(st->spi, &tx, sizeof(tx),
st->buffer.channels,
sizeof(st->buffer.channels));
> + if (ret < 0)
> + break;
>
> - iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer,
> - pf->timestamp);
> + iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer,
> + pf->timestamp);
> + } while (0);
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-04-29 19:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 19:51 [PATCH v3] iio: gyro: adxrs290: Use guard(mutex) in lieu of manual lock+unlock Guilherme Dias
2026-04-29 19:59 ` 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=afJjH1Mn_ZqKWN7L@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=guilhermeabreu200105@usp.br \
--cc=jic23@kernel.org \
--cc=jplinaris@usp.br \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=nish.malpani25@gmail.com \
--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