mirror of
https://github.com/torvalds/linux.git
synced 2026-10-12 13:27:02 +02:00
ASoC: codecs: aw88261: 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> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260708125002.202515-9-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
a0c8cd0ecf
commit
9d8e98091f
|
|
@ -8,6 +8,7 @@
|
|||
// Author: Weidong Wang <wangweidong.a@awinic.com>
|
||||
//
|
||||
|
||||
#include <linux/cleanup.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/bitops.h>
|
||||
|
|
@ -960,11 +961,10 @@ static int aw88261_profile_set(struct snd_kcontrol *kcontrol,
|
|||
int ret;
|
||||
|
||||
/* pa stop or stopping just set profile */
|
||||
mutex_lock(&aw88261->lock);
|
||||
guard(mutex)(&aw88261->lock);
|
||||
ret = aw88261_dev_set_profile_index(aw88261->aw_pa, ucontrol->value.integer.value[0]);
|
||||
if (ret) {
|
||||
dev_dbg(codec->dev, "profile index does not change");
|
||||
mutex_unlock(&aw88261->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -973,8 +973,6 @@ static int aw88261_profile_set(struct snd_kcontrol *kcontrol,
|
|||
aw88261_start(aw88261);
|
||||
}
|
||||
|
||||
mutex_unlock(&aw88261->lock);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -1038,7 +1036,7 @@ static int aw88261_playback_event(struct snd_soc_dapm_widget *w,
|
|||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
mutex_lock(&aw88261->lock);
|
||||
guard(mutex)(&aw88261->lock);
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
aw88261_start(aw88261);
|
||||
|
|
@ -1049,7 +1047,6 @@ static int aw88261_playback_event(struct snd_soc_dapm_widget *w,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
mutex_unlock(&aw88261->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1188,12 +1185,12 @@ static int aw88261_request_firmware_file(struct aw88261 *aw88261)
|
|||
return ret;
|
||||
}
|
||||
|
||||
mutex_lock(&aw88261->lock);
|
||||
/* aw device init */
|
||||
ret = aw88261_dev_init(aw88261, aw88261->aw_cfg);
|
||||
if (ret)
|
||||
dev_err(aw88261->aw_pa->dev, "dev init failed");
|
||||
mutex_unlock(&aw88261->lock);
|
||||
scoped_guard(mutex, &aw88261->lock) {
|
||||
/* aw device init */
|
||||
ret = aw88261_dev_init(aw88261, aw88261->aw_cfg);
|
||||
if (ret)
|
||||
dev_err(aw88261->aw_pa->dev, "dev init failed");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user