Re: [PATCH v4 3/3] iio: accel: bmc150: use guard(mutex) for mutex handling

Gabriel Rondon <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,org.kernel.vger.linux-iio
Message-ID <[email protected]>
On Mon, Aug 17, 2026 at 06:39:18PM +0300, Andy Shevchenko wrote:
> Not directly related to this change, but even in the original code what is
> protected here by the mutex? data->scan.channels?

Agreed it is out of scope for this cleanup, so I left the scope unchanged.

Honest answer: not much that is obvious. data->scan.channels does not need
it, since the triggered handler is the only writer and the core serializes
it. The accel one-shot read is already gated with -EBUSY while buffering, so
bmc150_accel_get_axis cannot race the handler. What is left sharing
data->mutex and still reachable during capture is the temperature read, the
bandwidth get/set and scale set, and the event config. But since the handler
is a single regmap_bulk_read and regmap already serializes the bus, it is not
clear the driver mutex guards a real invariant here, and it may well be
vestigial.

Dropping it is a behavioral change worth its own patch and testing rather
than something to fold into a lock-syntax cleanup. Happy to look into that
separately.

Thanks,
Gabriel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.