From: phucduc.bui@gmail.com
To: peter.ujfalusi@gmail.com, broonie@kernel.org
Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com,
jarkko.nikula@bitmer.com, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH 1/7] ASoC: ti: j721e-evm: Use guard() for mutex locks
Date: Fri, 8 May 2026 17:38:31 +0700 [thread overview]
Message-ID: <20260508103837.138142-2-phucduc.bui@gmail.com> (raw)
In-Reply-To: <20260508103837.138142-1-phucduc.bui@gmail.com>
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/ti/j721e-evm.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/sound/soc/ti/j721e-evm.c b/sound/soc/ti/j721e-evm.c
index faa62c1a9b8e..8a3333aa32ee 100644
--- a/sound/soc/ti/j721e-evm.c
+++ b/sound/soc/ti/j721e-evm.c
@@ -263,7 +263,7 @@ static int j721e_audio_startup(struct snd_pcm_substream *substream)
int ret = 0;
int i;
- mutex_lock(&priv->mutex);
+ guard(mutex)(&priv->mutex);
domain->active++;
@@ -303,7 +303,6 @@ static int j721e_audio_startup(struct snd_pcm_substream *substream)
out:
if (ret)
domain->active--;
- mutex_unlock(&priv->mutex);
return ret;
}
@@ -323,30 +322,28 @@ static int j721e_audio_hw_params(struct snd_pcm_substream *substream,
int ret;
int i;
- mutex_lock(&priv->mutex);
+ guard(mutex)(&priv->mutex);
- if (domain->rate && domain->rate != params_rate(params)) {
- ret = -EINVAL;
- goto out;
- }
+ if (domain->rate && domain->rate != params_rate(params))
+ return -EINVAL;
if (params_width(params) == 16)
slot_width = 16;
ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0x3, 0x3, 2, slot_width);
if (ret && ret != -ENOTSUPP)
- goto out;
+ return ret;
for_each_rtd_codec_dais(rtd, i, codec_dai) {
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 0x3, 2,
slot_width);
if (ret && ret != -ENOTSUPP)
- goto out;
+ return ret;
}
ret = j721e_configure_refclk(priv, domain_id, params_rate(params));
if (ret)
- goto out;
+ return ret;
sysclk_rate = priv->hsdiv_rates[domain->parent_clk_id];
for_each_rtd_codec_dais(rtd, i, codec_dai) {
@@ -356,7 +353,7 @@ static int j721e_audio_hw_params(struct snd_pcm_substream *substream,
dev_err(priv->dev,
"codec set_sysclk failed for %u Hz\n",
sysclk_rate);
- goto out;
+ return ret;
}
}
@@ -371,8 +368,6 @@ static int j721e_audio_hw_params(struct snd_pcm_substream *substream,
ret = 0;
}
-out:
- mutex_unlock(&priv->mutex);
return ret;
}
@@ -383,15 +378,13 @@ static void j721e_audio_shutdown(struct snd_pcm_substream *substream)
unsigned int domain_id = rtd->dai_link->id;
struct j721e_audio_domain *domain = &priv->audio_domains[domain_id];
- mutex_lock(&priv->mutex);
+ guard(mutex)(&priv->mutex);
domain->active--;
if (!domain->active) {
domain->rate = 0;
domain->active_link = 0;
}
-
- mutex_unlock(&priv->mutex);
}
static const struct snd_soc_ops j721e_audio_ops = {
--
2.43.0
next prev parent reply other threads:[~2026-05-08 10:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 10:38 [PATCH 0/7] ASoC: ti: Cleanup locking code using guard() helpers phucduc.bui
2026-05-08 10:38 ` phucduc.bui [this message]
2026-05-08 10:38 ` [PATCH 2/7] ASoC: ti: omap-dmic: Use guard() for mutex locks phucduc.bui
2026-05-08 10:38 ` [PATCH 3/7] ASoC: ti: omap-hdmi: " phucduc.bui
2026-05-08 10:38 ` [PATCH 4/7] ASoC: ti: omap-mcpdm: " phucduc.bui
2026-05-08 10:38 ` [PATCH 5/7] ASoC: ti: ams-delta: Use guard() for spin locks phucduc.bui
2026-05-08 10:38 ` [PATCH 6/7] ASoC: ti: omap-mcbsp-st: " phucduc.bui
2026-05-09 12:26 ` Jarkko Nikula
2026-05-08 10:38 ` [PATCH 7/7] ASoC: ti: omap-mcbsp: Simplify lock and resource handling phucduc.bui
2026-05-10 1:35 ` Mark Brown
2026-05-11 4:44 ` Bui Duc Phuc
2026-05-09 12:28 ` [PATCH 0/7] ASoC: ti: Cleanup locking code using guard() helpers Jarkko Nikula
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=20260508103837.138142-2-phucduc.bui@gmail.com \
--to=phucduc.bui@gmail.com \
--cc=broonie@kernel.org \
--cc=jarkko.nikula@bitmer.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@gmail.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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