Re: [PATCH v3] iio: accel: bmc150: use guard(mutex) for mutex handling
From: Andy Shevchenko
Date: Fri Jun 05 2026 - 13:57:07 EST
On Mon, May 25, 2026 at 12:01:27PM +0100, Gabriel Rondon wrote:
> Replace manual mutex_lock()/mutex_unlock() pairs with guard(mutex)
> and scoped_guard() from cleanup.h. This simplifies error paths by
> removing the need for explicit unlock calls before returning.
>
> Most converted functions hold the lock for their entire body, so
> guard(mutex) applies directly. bmc150_accel_trigger_handler() only
> holds the lock around a single register read, so scoped_guard() is
> used there to keep the lock scope unchanged.
The last paragraph is matter of the comment block or cover letter
(but currently it's a single patch, however with the below it becomes
a series).
...
> #include <linux/module.h>
> #include <linux/i2c.h>
> #include <linux/interrupt.h>
> +#include <linux/cleanup.h>
> #include <linux/delay.h>
> #include <linux/slab.h>
> #include <linux/acpi.h>
Please, add a preparatory patch to sort headers alphabetically first.
--
With Best Regards,
Andy Shevchenko