ASoC: Intel: catpt: Utilize lock-guard helper

The lock-guard helps simplify the driver's code.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20260603085827.1964796-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Cezary Rojewski 2026-06-03 10:58:21 +02:00 committed by Mark Brown
parent d1712cd69d
commit 36685d0b05
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 6 additions and 15 deletions

View File

@ -5,6 +5,7 @@
// Author: Cezary Rojewski <cezary.rojewski@intel.com>
//
#include <linux/cleanup.h>
#include <linux/devcoredump.h>
#include <linux/dma-mapping.h>
#include <linux/firmware.h>
@ -256,17 +257,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 +275,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 +300,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;
}

View File

@ -128,14 +128,9 @@ int catpt_dsp_send_msg_timeout(struct catpt_dev *cdev,
struct catpt_ipc_msg request,
struct catpt_ipc_msg *reply, int timeout, const char *name)
{
struct catpt_ipc *ipc = &cdev->ipc;
int ret;
guard(mutex)(&cdev->ipc.mutex);
mutex_lock(&ipc->mutex);
ret = catpt_dsp_do_send_msg(cdev, request, reply, timeout, name);
mutex_unlock(&ipc->mutex);
return ret;
return catpt_dsp_do_send_msg(cdev, request, reply, timeout, name);
}
int catpt_dsp_send_msg(struct catpt_dev *cdev, struct catpt_ipc_msg request,