[PATCH 02/20] ASoC: Intel: catpt: dsp: Use guard() for mutex locks
From: phucduc . bui
Date: Thu Jun 11 2026 - 08:00:57 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/intel/catpt/dsp.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/sound/soc/intel/catpt/dsp.c b/sound/soc/intel/catpt/dsp.c
index 677f348909c8..1eb1591213c4 100644
--- a/sound/soc/intel/catpt/dsp.c
+++ b/sound/soc/intel/catpt/dsp.c
@@ -256,17 +256,15 @@ static int catpt_dsp_select_lpclock(struct catpt_dev *cdev, bool lp, bool waiti)
u32 mask, reg, val;
int ret;
- mutex_lock(&cdev->clk_mutex);
+ guard(mutex)(&cdev->clk_mutex);
val = lp ? CATPT_CS_LPCS : 0;
reg = catpt_readl_shim(cdev, CS1) & CATPT_CS_LPCS;
dev_dbg(cdev->dev, "LPCS [0x%08lx] 0x%08x -> 0x%08x",
CATPT_CS_LPCS, reg, val);
- if (reg == val) {
- mutex_unlock(&cdev->clk_mutex);
+ if (reg == val)
return 0;
- }
if (waiti) {
/* wait for DSP to signal WAIT state */
@@ -276,10 +274,8 @@ static int catpt_dsp_select_lpclock(struct catpt_dev *cdev, bool lp, bool waiti)
if (ret) {
dev_warn(cdev->dev, "await WAITI timeout\n");
/* no signal - only high clock selection allowed */
- if (lp) {
- mutex_unlock(&cdev->clk_mutex);
+ if (lp)
return 0;
- }
}
}
@@ -303,7 +299,6 @@ static int catpt_dsp_select_lpclock(struct catpt_dev *cdev, bool lp, bool waiti)
/* update PLL accordingly */
cdev->spec->pll_shutdown(cdev, lp);
- mutex_unlock(&cdev->clk_mutex);
return 0;
}
--
2.43.0