summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorbui duc phuc <phucduc.bui@gmail.com>2026-07-21 17:25:50 +0700
committerMark Brown <broonie@kernel.org>2026-07-23 17:27:30 +0100
commitf1c58069475cb2f7b14efa5a19ce0f041b60a43f (patch)
tree68d3ace07acf0b292cd9514f76d1d758e5218fdf /sound
parent1937a1e0969e575148412f3f0af8a5a963f2944d (diff)
downloadlinux-next-f1c58069475cb2f7b14efa5a19ce0f041b60a43f.tar.gz
linux-next-f1c58069475cb2f7b14efa5a19ce0f041b60a43f.zip
ASoC: codecs: rt5665: Use guard() for mutex locks
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> Link: https://patch.msgid.link/20260721102600.523199-20-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/rt5665.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sound/soc/codecs/rt5665.c b/sound/soc/codecs/rt5665.c
index 48f57cd0920d..1d987472ba42 100644
--- a/sound/soc/codecs/rt5665.c
+++ b/sound/soc/codecs/rt5665.c
@@ -6,6 +6,7 @@
* Author: Bard Liao <bardliao@realtek.com>
*/
+#include <linux/cleanup.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
@@ -1208,7 +1209,7 @@ static void rt5665_jack_detect_handler(struct work_struct *work)
usleep_range(10000, 15000);
}
- mutex_lock(&rt5665->calibrate_mutex);
+ guard(mutex)(&rt5665->calibrate_mutex);
val = snd_soc_component_read(rt5665->component, RT5665_AJD1_CTRL) & 0x0010;
if (!val) {
@@ -1274,8 +1275,6 @@ static void rt5665_jack_detect_handler(struct work_struct *work)
schedule_delayed_work(&rt5665->jd_check_work, 0);
else
cancel_delayed_work_sync(&rt5665->jd_check_work);
-
- mutex_unlock(&rt5665->calibrate_mutex);
}
static const char * const rt5665_clk_sync[] = {
@@ -4564,7 +4563,7 @@ static void rt5665_calibrate(struct rt5665_priv *rt5665)
{
int value, count;
- mutex_lock(&rt5665->calibrate_mutex);
+ guard(mutex)(&rt5665->calibrate_mutex);
regcache_cache_bypass(rt5665->regmap, true);
@@ -4601,7 +4600,8 @@ static void rt5665_calibrate(struct rt5665_priv *rt5665)
pr_err("HP Calibration Failure\n");
regmap_write(rt5665->regmap, RT5665_RESET, 0);
regcache_cache_bypass(rt5665->regmap, false);
- goto out_unlock;
+ rt5665->calibration_done = true;
+ return;
}
count++;
@@ -4620,7 +4620,8 @@ static void rt5665_calibrate(struct rt5665_priv *rt5665)
pr_err("MONO Calibration Failure\n");
regmap_write(rt5665->regmap, RT5665_RESET, 0);
regcache_cache_bypass(rt5665->regmap, false);
- goto out_unlock;
+ rt5665->calibration_done = true;
+ return;
}
count++;
@@ -4635,9 +4636,7 @@ static void rt5665_calibrate(struct rt5665_priv *rt5665)
regmap_write(rt5665->regmap, RT5665_BIAS_CUR_CTRL_8, 0xa602);
regmap_write(rt5665->regmap, RT5665_ASRC_8, 0x0120);
-out_unlock:
rt5665->calibration_done = true;
- mutex_unlock(&rt5665->calibrate_mutex);
}
static void rt5665_calibrate_handler(struct work_struct *work)