ASoC: codecs: aw88399: 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-11-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
bui duc phuc 2026-07-08 19:49:47 +07:00 committed by Mark Brown
parent 6699b73f00
commit 49204ed803
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -7,6 +7,7 @@
// Author: Weidong Wang <wangweidong.a@awinic.com>
//
#include <linux/cleanup.h>
#include <linux/crc32.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
@ -1140,9 +1141,8 @@ static void aw88399_startup_work(struct work_struct *work)
struct aw88399 *aw88399 =
container_of(work, struct aw88399, start_work.work);
mutex_lock(&aw88399->lock);
guard(mutex)(&aw88399->lock);
aw88399_start_pa(aw88399);
mutex_unlock(&aw88399->lock);
}
static void aw88399_start(struct aw88399 *aw88399, bool sync_start)
@ -1702,11 +1702,10 @@ static int aw88399_profile_set(struct snd_kcontrol *kcontrol,
struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec);
int ret;
mutex_lock(&aw88399->lock);
guard(mutex)(&aw88399->lock);
ret = aw88399_dev_set_profile_index(aw88399->aw_pa, ucontrol->value.integer.value[0]);
if (ret) {
dev_dbg(codec->dev, "profile index does not change");
mutex_unlock(&aw88399->lock);
return 0;
}
@ -1715,8 +1714,6 @@ static int aw88399_profile_set(struct snd_kcontrol *kcontrol,
aw88399_start(aw88399, AW88399_SYNC_START);
}
mutex_unlock(&aw88399->lock);
return 1;
}
@ -1939,12 +1936,11 @@ static int aw88399_request_firmware_file(struct aw88399 *aw88399)
return ret;
}
mutex_lock(&aw88399->lock);
guard(mutex)(&aw88399->lock);
/* aw device init */
ret = aw88399_dev_init(aw88399, aw88399->aw_cfg);
if (ret)
dev_err(aw88399->aw_pa->dev, "dev init failed");
mutex_unlock(&aw88399->lock);
return ret;
}
@ -1975,7 +1971,7 @@ static int aw88399_playback_event(struct snd_soc_dapm_widget *w,
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component);
mutex_lock(&aw88399->lock);
guard(mutex)(&aw88399->lock);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
aw88399_start(aw88399, AW88399_ASYNC_START);
@ -1986,7 +1982,6 @@ static int aw88399_playback_event(struct snd_soc_dapm_widget *w,
default:
break;
}
mutex_unlock(&aw88399->lock);
return 0;
}