Re: [PATCH] regulator: userspace-consumer: Use atomic operation

From: Mark Brown
Date: Thu Aug 24 2023 - 12:56:55 EST


On Thu, Aug 24, 2023 at 04:34:05PM +0530, Naresh Solanki wrote:
> On Wed, 23 Aug 2023 at 20:41, Mark Brown <broonie@xxxxxxxxxx> wrote:
> > On Wed, Aug 23, 2023 at 04:15:57PM +0200, Naresh Solanki wrote:

> > > Replace mutexes with atomic operations.

> > Why? Generally atomics are more complicated and hard to understand and
> > get right.

> Since the operations involved here are simple & short & can be managed by
> atomic operation.

Unless there's a strong positive reason to specifically use atomics it
seems better to avoid them, like I say they're full of landmines with
unexpeted behaviours and therefore something that sets off alarm bells
about needing careful study, the mutex is going to be less preformant
but is also much more clearly correct.

Attachment: signature.asc
Description: PGP signature