Re: [PATCH 2/4] ASoC: stm: stm32_i2s: Use guard() for spin locks

From: Mark Brown

Date: Wed May 13 2026 - 21:26:00 EST


On Wed, May 13, 2026 at 05:43:27PM +0700, phucduc.bui@xxxxxxxxx wrote:

> @@ -1016,21 +1014,18 @@ static int stm32_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
> I2S_IER_OVRIE,
> (unsigned int)~I2S_IER_OVRIE);
>
> - spin_lock(&i2s->lock_fd);
> - i2s->refcount--;
> - if (i2s->refcount) {
> - spin_unlock(&i2s->lock_fd);
> - break;
> - }
> + scoped_guard(spinlock, &i2s->lock_fd) {
> + i2s->refcount--;
> + if (i2s->refcount)
> + break;

How does scoped_guard interact with break statements - does this still
apply to the switch? I've not looked at how they're implemented...

Attachment: signature.asc
Description: PGP signature