diff options
| author | bui duc phuc <phucduc.bui@gmail.com> | 2026-07-08 19:49:57 +0700 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-07-14 12:47:25 +0100 |
| commit | cea70877a2a191a6149544da7efeb12da2509cc8 (patch) | |
| tree | bbec68a7408994984f924f9e6147fad6e3184959 | |
| parent | db698e37213b29ccd680950593484652ae9f527a (diff) | |
| download | linux-cea70877a2a191a6149544da7efeb12da2509cc8.tar.gz linux-cea70877a2a191a6149544da7efeb12da2509cc8.zip | |
ASoC: codecs: cs47l85: Use guard() for mutex locks
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260708125002.202515-21-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | sound/soc/codecs/cs47l85.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sound/soc/codecs/cs47l85.c b/sound/soc/codecs/cs47l85.c index 42fafb0b392c..9ee60616c04c 100644 --- a/sound/soc/codecs/cs47l85.c +++ b/sound/soc/codecs/cs47l85.c @@ -6,6 +6,7 @@ // Cirrus Logic International Semiconductor Ltd. // +#include <linux/cleanup.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/device.h> @@ -2504,9 +2505,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 +2537,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); |
