Re: [PATCH v5 3/3] gpio: ws16c48: Migrate to the regmap API

From: William Breathitt Gray
Date: Mon Apr 03 2023 - 18:21:10 EST


On Mon, Apr 03, 2023 at 10:12:44PM +0100, Mark Brown wrote:
> On Sun, Apr 02, 2023 at 10:39:02AM -0400, William Breathitt Gray wrote:
> > On Mon, Mar 27, 2023 at 02:26:37PM +0300, Andy Shevchenko wrote:
> > > On Sun, Mar 26, 2023 at 12:25:59PM -0400, William Breathitt Gray wrote:
>
> > > > +static const struct regmap_config ws16c48_regmap_config = {
> > > > + .reg_bits = 8,
> > > > + .reg_stride = 1,
> > > > + .val_bits = 8,
> > > > + .io_port = true,
> > > > + .max_register = 0xA,
> > > > + .wr_table = &ws16c48_wr_table,
> > > > + .rd_table = &ws16c48_rd_table,
> > > > + .volatile_table = &ws16c48_volatile_table,
> > > > + .cache_type = REGCACHE_FLAT,
> > > > +};
>
> > > Do we need regmap lock?
>
> > We make regmap calls within an interrupt context in this driver so I
> > think we need to disable the default regmap mutex locking behavior; I
> > believe the current raw_spin_lock locking in this driver is enough to
> > protect access.
>
> The above doesn't configure the regmap locking so you'll have a spinlock
> by default (MMIO being a fast bus).

You're right, it'll be a spinlock in this case and not mutex.
Unfortunately, we'll still need to change that to avoid deadlocks on -rt
kernels [0].

William Breathitt Gray

[0] https://lore.kernel.org/all/1466065537-82027-1-git-send-email-mika.westerberg@xxxxxxxxxxxxxxx/

Attachment: signature.asc
Description: PGP signature