[PATCH v2 05/11] ASoC: fsl_spdif: Use guard() for spin locks
Frank Li
Frank.li at oss.nxp.com
Mon Jun 15 07:17:05 PDT 2026
On Mon, Jun 15, 2026 at 04:38:18PM +0700, phucduc.bui at gmail.com wrote:
> From: bui duc phuc <phucduc.bui at gmail.com>
>
> Clean up the code using guard() for spin locks.
> Merely code refactoring, and no behavior change.
>
> Signed-off-by: bui duc phuc <phucduc.bui at gmail.com>
> ---
Reviewed-by: Frank Li <Frank.Li at nxp.com>
> sound/soc/fsl/fsl_spdif.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
> index 1b9be85b34c2..ad1206ed9882 100644
> --- a/sound/soc/fsl/fsl_spdif.c
> +++ b/sound/soc/fsl/fsl_spdif.c
> @@ -853,17 +853,15 @@ static int fsl_spdif_subcode_get(struct snd_kcontrol *kcontrol,
> struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
> struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(cpu_dai);
> struct spdif_mixer_control *ctrl = &spdif_priv->fsl_spdif_control;
> - unsigned long flags;
> int ret = -EAGAIN;
>
> - spin_lock_irqsave(&ctrl->ctl_lock, flags);
> + guard(spinlock_irqsave)(&ctrl->ctl_lock);
> if (ctrl->ready_buf) {
> int idx = (ctrl->ready_buf - 1) * SPDIF_UBITS_SIZE;
> memcpy(&ucontrol->value.iec958.subcode[0],
> &ctrl->subcode[idx], SPDIF_UBITS_SIZE);
> ret = 0;
> }
> - spin_unlock_irqrestore(&ctrl->ctl_lock, flags);
>
> return ret;
> }
> @@ -885,17 +883,15 @@ static int fsl_spdif_qget(struct snd_kcontrol *kcontrol,
> struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
> struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(cpu_dai);
> struct spdif_mixer_control *ctrl = &spdif_priv->fsl_spdif_control;
> - unsigned long flags;
> int ret = -EAGAIN;
>
> - spin_lock_irqsave(&ctrl->ctl_lock, flags);
> + guard(spinlock_irqsave)(&ctrl->ctl_lock);
> if (ctrl->ready_buf) {
> int idx = (ctrl->ready_buf - 1) * SPDIF_QSUB_SIZE;
> memcpy(&ucontrol->value.bytes.data[0],
> &ctrl->qsub[idx], SPDIF_QSUB_SIZE);
> ret = 0;
> }
> - spin_unlock_irqrestore(&ctrl->ctl_lock, flags);
>
> return ret;
> }
> --
> 2.43.0
>
>
More information about the linux-arm-kernel
mailing list