mirror of
https://github.com/torvalds/linux.git
synced 2026-10-13 05:41:02 +02:00
ASoC: codecs: cs-amp-lib: 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: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260708125002.202515-13-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
35150d26cb
commit
53651103db
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <asm/byteorder.h>
|
||||
#include <kunit/static_stub.h>
|
||||
#include <linux/cleanup.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/dev_printk.h>
|
||||
#include <linux/efi.h>
|
||||
|
|
@ -83,10 +84,12 @@ static int cs_amp_write_cal_coeff(struct cs_dsp *dsp,
|
|||
KUNIT_STATIC_STUB_REDIRECT(cs_amp_write_cal_coeff, dsp, controls, ctl_name, val);
|
||||
|
||||
if (IS_REACHABLE(CONFIG_FW_CS_DSP)) {
|
||||
mutex_lock(&dsp->pwr_lock);
|
||||
cs_ctl = cs_dsp_get_ctl(dsp, ctl_name, controls->mem_region, controls->alg_id);
|
||||
ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, &beval, sizeof(beval));
|
||||
mutex_unlock(&dsp->pwr_lock);
|
||||
scoped_guard(mutex, &dsp->pwr_lock) {
|
||||
cs_ctl = cs_dsp_get_ctl(dsp, ctl_name,
|
||||
controls->mem_region,
|
||||
controls->alg_id);
|
||||
ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, &beval, sizeof(beval));
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
dev_err(dsp->dev, "Failed to write to '%s': %d\n", ctl_name, ret);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user