Re: [PATCH 1/2] regmap: teach regmap to use raw spinlocks if requested in the config

From: Mark Brown
Date: Mon Aug 30 2021 - 08:21:24 EST


On Fri, Aug 27, 2021 at 01:01:35AM +0200, Thomas Gleixner wrote:
> On Wed, Aug 25 2021 at 23:50, Vladimir Oltean wrote:

> > It seems reasonable for regmap to have an option use a raw spinlock too,
> > so add that in the config such that drivers can request it.

> What's reasonable about that?

> What exactly prevents the regmap locking to use a raw spinlock
> unconditionally?

We definitely can't use a raw spinlock unconditionally since we
support register maps on devices connected via buses which can't
be accessed atomically so we need the option of doing mutexes.

> Even for the case where the regmap is not dealing with irq chips it does
> not make any sense to protect low level operations on shared register
> with a regular spinlock. I might be missing something though...

That probably does make sense, I think we're just using regular
spinlocks for spinlocks mainly because they're the default rather
than because anyone put huge amounts of thought into it. IIRC
the first users were using spinlocks for their locking when they
were converted.

Attachment: signature.asc
Description: PGP signature