[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DG9BOO7V828W.2QYTAGRZ0BUNY@gmail.com>
Date: Sat, 07 Feb 2026 23:14:50 -0600
From: "Ethan Tidmore" <ethantidmore06@...il.com>
To: "Neel Bullywon" <neelb2403@...il.com>, "Jonathan Cameron"
<jic23@...nel.org>
Cc: "David Lechner" <dlechner@...libre.com>, Nuno Sá
<nuno.sa@...log.com>, "Andy Shevchenko" <andy@...nel.org>,
<linux-iio@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 1/2] iio: magnetometer: bmc150_magn: use automated
cleanup for mutex
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@...il.com>
Thanks,
ET
Powered by blists - more mailing lists