public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ethan Tidmore" <ethantidmore06@gmail.com>
To: "Neel Bullywon" <neelb2403@gmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 1/2] iio: magnetometer: bmc150_magn: use automated cleanup for mutex
Date: Sat, 07 Feb 2026 23:14:50 -0600	[thread overview]
Message-ID: <DG9BOO7V828W.2QYTAGRZ0BUNY@gmail.com> (raw)
In-Reply-To: <20260208011659.53722-2-neelb2403@gmail.com>

On Sat Feb 7, 2026 at 7:16 PM CST, Neel Bullywon wrote:
> Use guard() and scoped_guard() to replace manual mutex lock/unlock
> calls. This simplifies error handling and ensures RAII-style cleanup.
>
> Additionally, replace msleep(5) with fsleep(5000) to allow the kernel
> to select the most appropriate delay mechanism based on duration.

This should be its own patch. Please keep one logical change per patch.

>
> guard() is used in read_raw, write_raw, trig_reen, trigger_set_state,
> and resume. Case blocks in read_raw and write_raw are wrapped in braces
> to ensure clear scope for the cleanup guards.
>
> scoped_guard() is used in remove, runtime_suspend, and suspend where a
> short mutex-protected scope is needed for a single function call.
>
> The trigger_handler function is left unchanged as mixing guard() with
> goto error paths can be fragile.
>
> Signed-off-by: Neel Bullywon <neelb2403@gmail.com>

Thanks,

ET

  reply	other threads:[~2026-02-08  5:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-08  1:16 [PATCH v5 0/2] iio: magnetometer: bmc150_magn: cleanup and formatting Neel Bullywon
2026-02-08  1:16 ` [PATCH v5 1/2] iio: magnetometer: bmc150_magn: use automated cleanup for mutex Neel Bullywon
2026-02-08  5:14   ` Ethan Tidmore [this message]
2026-02-08 13:32   ` Andy Shevchenko
2026-02-08  1:16 ` [PATCH v5 2/2] iio: magnetometer: bmc150_magn: minor formatting cleanup Neel Bullywon
2026-02-08 13:35   ` Andy Shevchenko

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=DG9BOO7V828W.2QYTAGRZ0BUNY@gmail.com \
    --to=ethantidmore06@gmail.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=neelb2403@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