Re: [PATCH v4 3/3] iio: accel: bmc150: use guard(mutex) for mutex handling
Andy Shevchenko <[email protected]>
| Newsgroups | org.kernel.vger.linux-kernel,org.kernel.vger.linux-iio |
|---|---|
| Organization | Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo |
| Message-ID | <[email protected]> |
On Tue, Aug 18, 2026 at 04:41:35PM +0100, Gabriel Rondon wrote: > 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. Of course! Just made an observation. > Happy to look into that separately. If you have HW to test, I would like to see such a change. -- With Best Regards, Andy Shevchenko