mirror of
https://github.com/torvalds/linux.git
synced 2026-10-14 11:54:03 +02:00
ASoC: codecs: arizona: 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-5-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
d46421aeac
commit
fa58edfcce
|
|
@ -7,6 +7,7 @@
|
|||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*/
|
||||
|
||||
#include <linux/cleanup.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gcd.h>
|
||||
#include <linux/module.h>
|
||||
|
|
@ -1158,17 +1159,16 @@ int arizona_dvfs_up(struct snd_soc_component *component, unsigned int flags)
|
|||
struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&priv->dvfs_lock);
|
||||
guard(mutex)(&priv->dvfs_lock);
|
||||
|
||||
if (!priv->dvfs_cached && !priv->dvfs_reqs) {
|
||||
ret = arizona_dvfs_enable(component);
|
||||
if (ret)
|
||||
goto err;
|
||||
return ret;
|
||||
}
|
||||
|
||||
priv->dvfs_reqs |= flags;
|
||||
err:
|
||||
mutex_unlock(&priv->dvfs_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(arizona_dvfs_up);
|
||||
|
|
@ -1179,7 +1179,7 @@ int arizona_dvfs_down(struct snd_soc_component *component, unsigned int flags)
|
|||
unsigned int old_reqs;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&priv->dvfs_lock);
|
||||
guard(mutex)(&priv->dvfs_lock);
|
||||
|
||||
old_reqs = priv->dvfs_reqs;
|
||||
priv->dvfs_reqs &= ~flags;
|
||||
|
|
@ -1187,7 +1187,6 @@ int arizona_dvfs_down(struct snd_soc_component *component, unsigned int flags)
|
|||
if (!priv->dvfs_cached && old_reqs && !priv->dvfs_reqs)
|
||||
ret = arizona_dvfs_disable(component);
|
||||
|
||||
mutex_unlock(&priv->dvfs_lock);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(arizona_dvfs_down);
|
||||
|
|
@ -1199,7 +1198,7 @@ int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w,
|
|||
struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&priv->dvfs_lock);
|
||||
guard(mutex)(&priv->dvfs_lock);
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
|
|
@ -1222,7 +1221,6 @@ int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w,
|
|||
break;
|
||||
}
|
||||
|
||||
mutex_unlock(&priv->dvfs_lock);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(arizona_dvfs_sysclk_ev);
|
||||
|
|
@ -1657,13 +1655,11 @@ static void arizona_wm5102_set_dac_comp(struct snd_soc_component *component,
|
|||
{ 0x80, 0x0 },
|
||||
};
|
||||
|
||||
mutex_lock(&arizona->dac_comp_lock);
|
||||
|
||||
dac_comp[1].def = arizona->dac_comp_coeff;
|
||||
if (rate >= 176400)
|
||||
dac_comp[2].def = arizona->dac_comp_enabled;
|
||||
|
||||
mutex_unlock(&arizona->dac_comp_lock);
|
||||
scoped_guard(mutex, &arizona->dac_comp_lock) {
|
||||
dac_comp[1].def = arizona->dac_comp_coeff;
|
||||
if (rate >= 176400)
|
||||
dac_comp[2].def = arizona->dac_comp_enabled;
|
||||
}
|
||||
|
||||
regmap_multi_reg_write(arizona->regmap,
|
||||
dac_comp,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user