mirror of
https://github.com/torvalds/linux.git
synced 2026-10-09 12:06:03 +02:00
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>
This commit is contained in:
parent
1937a1e096
commit
f1c5806947
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user