Re: [PATCH] ASoC: meson: gx-formatter: change stream lock from mutex to spinlock
From: Martin Blumenstingl
Date: Sun Nov 08 2026 - 16:02:22 EST
Hi Valerio,
On Wed, Oct 21, 2026 at 11:52 PM Valerio Setti <vsetti@xxxxxxxxxxxx> wrote:
[...]
> @@ -85,9 +85,9 @@ static void gx_formatter_detach(struct gx_formatter *formatter)
> if (!ts)
> return;
>
> - mutex_lock(&ts->lock);
> + spin_lock_irq(&ts->lock);
> list_del(&formatter->list);
> - mutex_unlock(&ts->lock);
> + spin_unlock_irq(&ts->lock);
>
> gx_formatter_disable(formatter);
The documentation below states that ->ops->disable is called with the lock held.
gx_stream_stop() does call it with the locks held but
gx_formatter_detach here doesn't.
It doesn't seem to be problematic yet because aiu-formatter-i2s.c
doesn't register a ->disable callback.
Can you please still look into whether this is a problem?
Also for a future patch (not this bugfix anymore) it would be great to
have lockdep_assert_held validate that the lock has been taken (inside
->enable, ->disable and ->prepare).
[...]
> struct gx_formatter_ops {
> struct gx_stream *(*get_stream)(struct snd_soc_dapm_widget *w);
> + /*
> + * Following functions are called with gx_stream->lock held and local
> + * IRQs disabled so they must not sleep.
> + */
> void (*enable)(struct regmap *map);
> void (*disable)(struct regmap *map);
> int (*prepare)(struct regmap *map,
Thank you and best regards,
Martin