On Mon, Jun 15, 2026 at 04:38:17PM +0700, [email protected] wrote: > From: bui duc phuc <[email protected]> > > Clean up the code using guard() for spin locks. > Merely code refactoring, and no behavior change. > > Signed-off-by: bui duc phuc <[email protected]> > ---
Reviewed-by: Frank Li <[email protected]> > sound/soc/fsl/fsl_esai.c | 16 +++++----------- > 1 file changed, 5 insertions(+), 11 deletions(-) > > diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c > index cde0b0c6c1ef..4a530a6c33f0 100644 > --- a/sound/soc/fsl/fsl_esai.c > +++ b/sound/soc/fsl/fsl_esai.c > @@ -709,10 +709,9 @@ static void fsl_esai_hw_reset(struct work_struct *work) > { > struct fsl_esai *esai_priv = container_of(work, struct fsl_esai, work); > bool tx = true, rx = false, enabled[2]; > - unsigned long lock_flags; > u32 tfcr, rfcr; > > - spin_lock_irqsave(&esai_priv->lock, lock_flags); > + guard(spinlock_irqsave)(&esai_priv->lock); > /* Save the registers */ > regmap_read(esai_priv->regmap, REG_ESAI_TFCR, &tfcr); > regmap_read(esai_priv->regmap, REG_ESAI_RFCR, &rfcr); > @@ -750,8 +749,6 @@ static void fsl_esai_hw_reset(struct work_struct *work) > fsl_esai_trigger_start(esai_priv, tx); > if (enabled[rx]) > fsl_esai_trigger_start(esai_priv, rx); > - > - spin_unlock_irqrestore(&esai_priv->lock, lock_flags); > } > > static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd, > @@ -759,7 +756,6 @@ static int fsl_esai_trigger(struct snd_pcm_substream > *substream, int cmd, > { > struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai); > bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; > - unsigned long lock_flags; > > esai_priv->channels[tx] = substream->runtime->channels; > > @@ -767,16 +763,14 @@ static int fsl_esai_trigger(struct snd_pcm_substream > *substream, int cmd, > case SNDRV_PCM_TRIGGER_START: > case SNDRV_PCM_TRIGGER_RESUME: > case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: > - spin_lock_irqsave(&esai_priv->lock, lock_flags); > - fsl_esai_trigger_start(esai_priv, tx); > - spin_unlock_irqrestore(&esai_priv->lock, lock_flags); > + scoped_guard(spinlock_irqsave, &esai_priv->lock) > + fsl_esai_trigger_start(esai_priv, tx); > break; > case SNDRV_PCM_TRIGGER_SUSPEND: > case SNDRV_PCM_TRIGGER_STOP: > case SNDRV_PCM_TRIGGER_PAUSE_PUSH: > - spin_lock_irqsave(&esai_priv->lock, lock_flags); > - fsl_esai_trigger_stop(esai_priv, tx); > - spin_unlock_irqrestore(&esai_priv->lock, lock_flags); > + scoped_guard(spinlock_irqsave, &esai_priv->lock) > + fsl_esai_trigger_stop(esai_priv, tx); > break; > default: > return -EINVAL; > -- > 2.43.0 > >
