[PATCH 20/78] ASoC: codecs: cs47l85: Use guard() for mutex locks
From: phucduc . bui
Date: Wed Jun 17 2026 - 06:40:28 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/codecs/cs47l85.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/cs47l85.c b/sound/soc/codecs/cs47l85.c
index 42fafb0b392c..9c0eaf24bd54 100644
--- a/sound/soc/codecs/cs47l85.c
+++ b/sound/soc/codecs/cs47l85.c
@@ -2504,9 +2504,8 @@ static int cs47l85_component_probe(struct snd_soc_component *component)
snd_soc_component_init_regmap(component, madera->regmap);
- mutex_lock(&madera->dapm_ptr_lock);
- madera->dapm = snd_soc_component_to_dapm(component);
- mutex_unlock(&madera->dapm_ptr_lock);
+ scoped_guard(mutex, &madera->dapm_ptr_lock)
+ madera->dapm = snd_soc_component_to_dapm(component);
ret = madera_init_inputs(component);
if (ret)
@@ -2537,9 +2536,8 @@ static void cs47l85_component_remove(struct snd_soc_component *component)
struct madera *madera = cs47l85->core.madera;
int i;
- mutex_lock(&madera->dapm_ptr_lock);
- madera->dapm = NULL;
- mutex_unlock(&madera->dapm_ptr_lock);
+ scoped_guard(mutex, &madera->dapm_ptr_lock)
+ madera->dapm = NULL;
for (i = 0; i < CS47L85_NUM_ADSP; i++)
wm_adsp2_component_remove(&cs47l85->core.adsp[i], component);
--
2.43.0