From: phucduc.bui@gmail•com
To: Mark Brown <broonie@kernel•org>
Cc: Liam Girdwood <lgirdwood@gmail•com>,
Jaroslav Kysela <perex@perex•cz>, Takashi Iwai <tiwai@suse•com>,
Chen-Yu Tsai <wens@kernel•org>,
Jernej Skrabec <jernej.skrabec@gmail•com>,
Samuel Holland <samuel@sholland•org>,
Marcus Cooper <codekipper@gmail•com>,
Chen Ni <nichen@iscas•ac.cn>,
linux-sound@vger•kernel.org, linux-sunxi@lists•linux.dev,
linux-arm-kernel@lists•infradead.org,
linux-kernel@vger•kernel.org,
bui duc phuc <phucduc.bui@gmail•com>
Subject: [PATCH] ASoC: sun4i-spdif: Use guard() for spin locks
Date: Wed, 13 May 2026 17:50:03 +0700 [thread overview]
Message-ID: <20260513105003.81880-1-phucduc.bui@gmail.com> (raw)
From: bui duc phuc <phucduc.bui@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@gmail•com>
---
sound/soc/sunxi/sun4i-spdif.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
index c2ec19437cd7..ec00779182db 100644
--- a/sound/soc/sunxi/sun4i-spdif.c
+++ b/sound/soc/sunxi/sun4i-spdif.c
@@ -427,10 +427,9 @@ static int sun4i_spdif_get_status(struct snd_kcontrol *kcontrol,
struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(cpu_dai);
u8 *status = ucontrol->value.iec958.status;
- unsigned long flags;
unsigned int reg;
- spin_lock_irqsave(&host->lock, flags);
+ guard(spinlock_irqsave)(&host->lock);
regmap_read(host->regmap, SUN4I_SPDIF_TXCHSTA0, ®);
@@ -444,8 +443,6 @@ static int sun4i_spdif_get_status(struct snd_kcontrol *kcontrol,
status[4] = reg & 0xff;
status[5] = (reg >> 8) & 0x3;
- spin_unlock_irqrestore(&host->lock, flags);
-
return 0;
}
@@ -455,11 +452,10 @@ static int sun4i_spdif_set_status(struct snd_kcontrol *kcontrol,
struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol);
struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(cpu_dai);
u8 *status = ucontrol->value.iec958.status;
- unsigned long flags;
unsigned int reg;
bool chg0, chg1;
- spin_lock_irqsave(&host->lock, flags);
+ guard(spinlock_irqsave)(&host->lock);
reg = (u32)status[3] << 24;
reg |= (u32)status[2] << 16;
@@ -483,8 +479,6 @@ static int sun4i_spdif_set_status(struct snd_kcontrol *kcontrol,
SUN4I_SPDIF_TXCFG_CHSTMODE |
SUN4I_SPDIF_TXCFG_NONAUDIO, reg);
- spin_unlock_irqrestore(&host->lock, flags);
-
return chg0 || chg1;
}
--
2.43.0
next reply other threads:[~2026-05-13 10:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 10:50 phucduc.bui [this message]
[not found] ` <20260514043314.62222C2BCB7@smtp.kernel.org>
[not found] ` <CAABR9nGhwtBu9Yhbn-BTD1Scykp2h6eQbtQtT13DcnekUdum1A@mail.gmail.com>
2026-05-16 11:56 ` [PATCH] ASoC: sun4i-spdif: Use guard() for spin locks Bui Duc Phuc
2026-05-16 23:50 ` Bui Duc Phuc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260513105003.81880-1-phucduc.bui@gmail.com \
--to=phucduc.bui@gmail$(echo .)com \
--cc=broonie@kernel$(echo .)org \
--cc=codekipper@gmail$(echo .)com \
--cc=jernej.skrabec@gmail$(echo .)com \
--cc=lgirdwood@gmail$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-sound@vger$(echo .)kernel.org \
--cc=linux-sunxi@lists$(echo .)linux.dev \
--cc=nichen@iscas$(echo .)ac.cn \
--cc=perex@perex$(echo .)cz \
--cc=samuel@sholland$(echo .)org \
--cc=tiwai@suse$(echo .)com \
--cc=wens@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox