* [PATCH] ASoC: apple: mca: Use guard() for mutex locks
@ 2026-04-23 12:51 phucduc.bui
2026-04-26 21:52 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: phucduc.bui @ 2026-04-23 12:51 UTC (permalink / raw)
To: Mark Brown
Cc: Martin Povišer, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
asahi, linux-sound, linux-kernel, bui duc phuc
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/apple/mca.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/sound/soc/apple/mca.c b/sound/soc/apple/mca.c
index 39269cc7def6..492165c0e1ea 100644
--- a/sound/soc/apple/mca.c
+++ b/sound/soc/apple/mca.c
@@ -307,7 +307,7 @@ static bool mca_fe_clocks_in_use(struct mca_cluster *cl)
struct mca_cluster *be_cl;
int stream, i;
- mutex_lock(&mca->port_mutex);
+ guard(mutex)(&mca->port_mutex);
for (i = 0; i < mca->nclusters; i++) {
be_cl = &mca->clusters[i];
@@ -316,12 +316,10 @@ static bool mca_fe_clocks_in_use(struct mca_cluster *cl)
for_each_pcm_streams(stream) {
if (be_cl->clocks_in_use[stream]) {
- mutex_unlock(&mca->port_mutex);
return true;
}
}
}
- mutex_unlock(&mca->port_mutex);
return false;
}
@@ -765,9 +763,8 @@ static int mca_be_startup(struct snd_pcm_substream *substream,
cl->base + REG_PORT_CLOCK_SEL);
writel_relaxed(PORT_DATA_SEL_TXA(fe_cl->no),
cl->base + REG_PORT_DATA_SEL);
- mutex_lock(&mca->port_mutex);
- cl->port_driver = fe_cl->no;
- mutex_unlock(&mca->port_mutex);
+ scoped_guard(mutex, &mca->port_mutex)
+ cl->port_driver = fe_cl->no;
cl->port_started[substream->stream] = true;
return 0;
@@ -788,9 +785,8 @@ static void mca_be_shutdown(struct snd_pcm_substream *substream,
*/
writel_relaxed(0, cl->base + REG_PORT_ENABLES);
writel_relaxed(0, cl->base + REG_PORT_DATA_SEL);
- mutex_lock(&mca->port_mutex);
- cl->port_driver = -1;
- mutex_unlock(&mca->port_mutex);
+ scoped_guard(mutex, &mca->port_mutex)
+ cl->port_driver = -1;
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: apple: mca: Use guard() for mutex locks
2026-04-23 12:51 [PATCH] ASoC: apple: mca: Use guard() for mutex locks phucduc.bui
@ 2026-04-26 21:52 ` Mark Brown
2026-04-27 5:58 ` Bui Duc Phuc
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2026-04-26 21:52 UTC (permalink / raw)
To: phucduc.bui
Cc: Martin Povišer, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
asahi, linux-sound, linux-kernel
On Thu, 23 Apr 2026 19:51:54 +0700, phucduc.bui@gmail.com wrote:
> ASoC: apple: mca: Use guard() for mutex locks
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2
Thanks!
[1/1] ASoC: apple: mca: Use guard() for mutex locks
https://git.kernel.org/broonie/sound/c/fc86d55e8b78
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: apple: mca: Use guard() for mutex locks
2026-04-26 21:52 ` Mark Brown
@ 2026-04-27 5:58 ` Bui Duc Phuc
0 siblings, 0 replies; 3+ messages in thread
From: Bui Duc Phuc @ 2026-04-27 5:58 UTC (permalink / raw)
To: Mark Brown
Cc: Martin Povišer, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
asahi, linux-sound, linux-kernel
Hi Mark,
Thank you for applying the patch and for the explanation.
I'm still new to the process, so I appreciate the guidance.
Best regards,
Phuc
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-27 5:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 12:51 [PATCH] ASoC: apple: mca: Use guard() for mutex locks phucduc.bui
2026-04-26 21:52 ` Mark Brown
2026-04-27 5:58 ` Bui Duc Phuc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox