diff options
| author | Cezary Rojewski <cezary.rojewski@intel.com> | 2026-06-03 10:58:21 +0200 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-06-04 17:00:22 +0100 |
| commit | 36685d0b05d91e13df5cb65726b7cb4c026e41d0 (patch) | |
| tree | 2e888834cff21fe0d29686afd55f642b321773f2 | |
| parent | d1712cd69d2163e20dc4c1bd269a3130b6c454ca (diff) | |
| download | linux-36685d0b05d91e13df5cb65726b7cb4c026e41d0.tar.gz linux-36685d0b05d91e13df5cb65726b7cb4c026e41d0.zip | |
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>
| -rw-r--r-- | sound/soc/intel/catpt/dsp.c | 12 | ||||
| -rw-r--r-- | sound/soc/intel/catpt/ipc.c | 9 |
2 files changed, 6 insertions, 15 deletions
diff --git a/sound/soc/intel/catpt/dsp.c b/sound/soc/intel/catpt/dsp.c index 677f348909c8..b1865d10f995 100644 --- a/sound/soc/intel/catpt/dsp.c +++ b/sound/soc/intel/catpt/dsp.c @@ -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; } diff --git a/sound/soc/intel/catpt/ipc.c b/sound/soc/intel/catpt/ipc.c index 225757e6a776..8092944d6cb7 100644 --- a/sound/soc/intel/catpt/ipc.c +++ b/sound/soc/intel/catpt/ipc.c @@ -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, |
