Re: [PATCH v3] iio: magnetometer: rm3100: Modernize locking and refactor control flow

Andy Shevchenko
2026-04-29T18:26:19Z

On Wed, Apr 29, 2026 at 10:19:14AM -0500, Maxwell Doose wrote:
> On Wed, Apr 29, 2026 at 5:42 AM Jonathan Cameron <jic23@kernel.org> wrote:

...

> If I find other patterns that do this kind of:
> lock(&my_mutex);
> ret = my_function(params);
> unlock(&my_mutex);
> then it may be a good idea to consider writing a helper-wrapper in a
> header that takes in a function pointer and its params. It would take
> more thought, and we'd probably have to avoid variadic arguments, but
> it may be a good idea just so we can keep the same scope and keep the
> logic clean.

Won't fly. I am pretty sure most of the maintainers find that bad. The problem
is that the caller should be crystal clear to show what the critical section
is. Hiding that information behind macros drastically reduces understanding of
the code,

...

> I think that would be sound
> for a separate patch. I'd ordinarily include that in this patch, but I
> feel at that point we might be deviating from the original purpose of
> the patch.

I agree.

--
With Best Regards,
Andy Shevchenko