* [PATCH 01/20] ASoC: Intel: catpt: ipc: Use guard() for mutex & spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 18:44 ` Cezary Rojewski
2026-06-11 11:58 ` [PATCH 02/20] ASoC: Intel: catpt: dsp: Use guard() for mutex locks phucduc.bui
` (19 subsequent siblings)
20 siblings, 1 reply; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex & spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/catpt/ipc.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/sound/soc/intel/catpt/ipc.c b/sound/soc/intel/catpt/ipc.c
index 2e3b7a5cbb9b..9614ade5d31a 100644
--- a/sound/soc/intel/catpt/ipc.c
+++ b/sound/soc/intel/catpt/ipc.c
@@ -88,7 +88,6 @@ static int catpt_dsp_do_send_msg(struct catpt_dev *cdev,
struct catpt_ipc_msg *reply, int timeout, const char *name)
{
struct catpt_ipc *ipc = &cdev->ipc;
- unsigned long flags;
int ret;
if (!ipc->ready)
@@ -97,10 +96,10 @@ static int catpt_dsp_do_send_msg(struct catpt_dev *cdev,
(reply && reply->size > ipc->config.outbox_size))
return -EINVAL;
- spin_lock_irqsave(&ipc->lock, flags);
- catpt_ipc_msg_init(ipc, reply);
- catpt_dsp_send_tx(cdev, &request);
- spin_unlock_irqrestore(&ipc->lock, flags);
+ scoped_guard(spinlock_irqsave, &ipc->lock) {
+ catpt_ipc_msg_init(ipc, reply);
+ catpt_dsp_send_tx(cdev, &request);
+ }
ret = catpt_wait_msg_completion(cdev, timeout);
if (ret) {
@@ -131,9 +130,8 @@ int catpt_dsp_send_msg_timeout(struct catpt_dev *cdev,
struct catpt_ipc *ipc = &cdev->ipc;
int ret;
- mutex_lock(&ipc->mutex);
+ guard(mutex)(&ipc->mutex);
ret = catpt_dsp_do_send_msg(cdev, request, reply, timeout, name);
- mutex_unlock(&ipc->mutex);
return ret;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* Re: [PATCH 01/20] ASoC: Intel: catpt: ipc: Use guard() for mutex & spin locks
2026-06-11 11:58 ` [PATCH 01/20] ASoC: Intel: catpt: ipc: " phucduc.bui
@ 2026-06-11 18:44 ` Cezary Rojewski
0 siblings, 0 replies; 25+ messages in thread
From: Cezary Rojewski @ 2026-06-11 18:44 UTC (permalink / raw)
To: phucduc.bui
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
Mark Brown, Liam Girdwood
On 6/11/2026 1:58 PM, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Clean up the code using guard() for mutex & spin locks.
> Merely code refactoring, and no behavior change.
The catpt_dsp_send_msg_timeout is already part of Mark's tree [1]. At
the same time I'm against using scoped_guard() for
catpt_dsp_do_send_msg(). The existing code is small and transparent,
there is no need to tabify it.
[1]:
https://lore.kernel.org/all/20260603085827.1964796-2-cezary.rojewski@intel.com/
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
> sound/soc/intel/catpt/ipc.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/sound/soc/intel/catpt/ipc.c b/sound/soc/intel/catpt/ipc.c
> index 2e3b7a5cbb9b..9614ade5d31a 100644
> --- a/sound/soc/intel/catpt/ipc.c
> +++ b/sound/soc/intel/catpt/ipc.c
> @@ -88,7 +88,6 @@ static int catpt_dsp_do_send_msg(struct catpt_dev *cdev,
> struct catpt_ipc_msg *reply, int timeout, const char *name)
> {
> struct catpt_ipc *ipc = &cdev->ipc;
> - unsigned long flags;
> int ret;
>
> if (!ipc->ready)
> @@ -97,10 +96,10 @@ static int catpt_dsp_do_send_msg(struct catpt_dev *cdev,
> (reply && reply->size > ipc->config.outbox_size))
> return -EINVAL;
>
> - spin_lock_irqsave(&ipc->lock, flags);
> - catpt_ipc_msg_init(ipc, reply);
> - catpt_dsp_send_tx(cdev, &request);
> - spin_unlock_irqrestore(&ipc->lock, flags);
> + scoped_guard(spinlock_irqsave, &ipc->lock) {
> + catpt_ipc_msg_init(ipc, reply);
> + catpt_dsp_send_tx(cdev, &request);
> + }
>
> ret = catpt_wait_msg_completion(cdev, timeout);
> if (ret) {
> @@ -131,9 +130,8 @@ int catpt_dsp_send_msg_timeout(struct catpt_dev *cdev,
> struct catpt_ipc *ipc = &cdev->ipc;
> int ret;
>
> - mutex_lock(&ipc->mutex);
> + guard(mutex)(&ipc->mutex);
> ret = catpt_dsp_do_send_msg(cdev, request, reply, timeout, name);
> - mutex_unlock(&ipc->mutex);
>
> return ret;
> }
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 02/20] ASoC: Intel: catpt: dsp: Use guard() for mutex locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
2026-06-11 11:58 ` [PATCH 01/20] ASoC: Intel: catpt: ipc: " phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 18:39 ` Cezary Rojewski
2026-06-11 11:58 ` [PATCH 03/20] ASoC: Intel: avs: utils: " phucduc.bui
` (18 subsequent siblings)
20 siblings, 1 reply; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 25+ messages in thread* Re: [PATCH 02/20] ASoC: Intel: catpt: dsp: Use guard() for mutex locks
2026-06-11 11:58 ` [PATCH 02/20] ASoC: Intel: catpt: dsp: Use guard() for mutex locks phucduc.bui
@ 2026-06-11 18:39 ` Cezary Rojewski
0 siblings, 0 replies; 25+ messages in thread
From: Cezary Rojewski @ 2026-06-11 18:39 UTC (permalink / raw)
To: phucduc.bui
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
Mark Brown, Liam Girdwood
On 6/11/2026 1:58 PM, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Clean up the code using guard() for mutex locks.
> Merely code refactoring, and no behavior change.
Already part of Mark's tree [1].
[1]:
https://lore.kernel.org/all/20260603085827.1964796-2-cezary.rojewski@intel.com/
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
> 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;
> }
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 03/20] ASoC: Intel: avs: utils: Use guard() for mutex locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
2026-06-11 11:58 ` [PATCH 01/20] ASoC: Intel: catpt: ipc: " phucduc.bui
2026-06-11 11:58 ` [PATCH 02/20] ASoC: Intel: catpt: dsp: Use guard() for mutex locks phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 04/20] ASoC: Intel: avs: probes: Use guard() for spin locks phucduc.bui
` (17 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/utils.c | 39 +++++++++++++------------------------
1 file changed, 13 insertions(+), 26 deletions(-)
diff --git a/sound/soc/intel/avs/utils.c b/sound/soc/intel/avs/utils.c
index ee36725ac731..ca1236731824 100644
--- a/sound/soc/intel/avs/utils.c
+++ b/sound/soc/intel/avs/utils.c
@@ -48,13 +48,12 @@ int avs_get_module_entry(struct avs_dev *adev, const guid_t *uuid, struct avs_mo
{
int idx;
- mutex_lock(&adev->modres_mutex);
+ guard(mutex)(&adev->modres_mutex);
idx = avs_module_entry_index(adev, uuid);
if (idx >= 0)
memcpy(entry, &adev->mods_info->entries[idx], sizeof(*entry));
- mutex_unlock(&adev->modres_mutex);
return (idx < 0) ? idx : 0;
}
@@ -62,13 +61,12 @@ int avs_get_module_id_entry(struct avs_dev *adev, u32 module_id, struct avs_modu
{
int idx;
- mutex_lock(&adev->modres_mutex);
+ guard(mutex)(&adev->modres_mutex);
idx = avs_module_id_entry_index(adev, module_id);
if (idx >= 0)
memcpy(entry, &adev->mods_info->entries[idx], sizeof(*entry));
- mutex_unlock(&adev->modres_mutex);
return (idx < 0) ? idx : 0;
}
@@ -86,13 +84,12 @@ bool avs_is_module_ida_empty(struct avs_dev *adev, u32 module_id)
bool ret = false;
int idx;
- mutex_lock(&adev->modres_mutex);
+ guard(mutex)(&adev->modres_mutex);
idx = avs_module_id_entry_index(adev, module_id);
if (idx >= 0)
ret = ida_is_empty(adev->mod_idas[idx]);
- mutex_unlock(&adev->modres_mutex);
return ret;
}
@@ -163,50 +160,44 @@ int avs_module_info_init(struct avs_dev *adev, bool purge)
if (ret)
return AVS_IPC_RET(ret);
- mutex_lock(&adev->modres_mutex);
+ guard(mutex)(&adev->modres_mutex);
ret = avs_module_ida_alloc(adev, info, purge);
if (ret < 0) {
dev_err(adev->dev, "initialize module idas failed: %d\n", ret);
- goto exit;
+ return ret;
}
/* Refresh current information with newly received table. */
kfree(adev->mods_info);
adev->mods_info = info;
-exit:
- mutex_unlock(&adev->modres_mutex);
return ret;
}
void avs_module_info_free(struct avs_dev *adev)
{
- mutex_lock(&adev->modres_mutex);
+ guard(mutex)(&adev->modres_mutex);
avs_module_ida_destroy(adev);
kfree(adev->mods_info);
adev->mods_info = NULL;
-
- mutex_unlock(&adev->modres_mutex);
}
int avs_module_id_alloc(struct avs_dev *adev, u16 module_id)
{
int ret, idx, max_id;
- mutex_lock(&adev->modres_mutex);
+ guard(mutex)(&adev->modres_mutex);
idx = avs_module_id_entry_index(adev, module_id);
if (idx == -ENOENT) {
dev_err(adev->dev, "invalid module id: %d", module_id);
- ret = -EINVAL;
- goto exit;
+ return -EINVAL;
}
max_id = adev->mods_info->entries[idx].instance_max_count - 1;
ret = ida_alloc_max(adev->mod_idas[idx], max_id, GFP_KERNEL);
-exit:
- mutex_unlock(&adev->modres_mutex);
+
return ret;
}
@@ -214,17 +205,13 @@ void avs_module_id_free(struct avs_dev *adev, u16 module_id, u8 instance_id)
{
int idx;
- mutex_lock(&adev->modres_mutex);
+ guard(mutex)(&adev->modres_mutex);
idx = avs_module_id_entry_index(adev, module_id);
- if (idx == -ENOENT) {
+ if (idx == -ENOENT)
dev_err(adev->dev, "invalid module id: %d", module_id);
- goto exit;
- }
-
- ida_free(adev->mod_idas[idx], instance_id);
-exit:
- mutex_unlock(&adev->modres_mutex);
+ else
+ ida_free(adev->mod_idas[idx], instance_id);
}
/*
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 04/20] ASoC: Intel: avs: probes: Use guard() for spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (2 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 03/20] ASoC: Intel: avs: utils: " phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 19:34 ` Cezary Rojewski
2026-06-11 11:58 ` [PATCH 05/20] ASoC: Intel: avs: pcm: Use guard() for mutex & " phucduc.bui
` (16 subsequent siblings)
20 siblings, 1 reply; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/probes.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/sound/soc/intel/avs/probes.c b/sound/soc/intel/avs/probes.c
index 099119ad28b3..13d933ab77cd 100644
--- a/sound/soc/intel/avs/probes.c
+++ b/sound/soc/intel/avs/probes.c
@@ -186,7 +186,6 @@ static int avs_probe_compr_trigger(struct snd_compr_stream *cstream, int cmd,
struct hdac_ext_stream *host_stream = avs_compr_get_host_stream(cstream);
struct avs_dev *adev = to_avs_dev(dai->dev);
struct hdac_bus *bus = &adev->base.core;
- unsigned long cookie;
if (!hdac_stream(host_stream)->prepared)
return -EPIPE;
@@ -195,17 +194,15 @@ static int avs_probe_compr_trigger(struct snd_compr_stream *cstream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
- spin_lock_irqsave(&bus->reg_lock, cookie);
- snd_hdac_stream_start(hdac_stream(host_stream));
- spin_unlock_irqrestore(&bus->reg_lock, cookie);
+ scoped_guard(spinlock_irqsave, &bus->reg_lock)
+ snd_hdac_stream_start(hdac_stream(host_stream));
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_STOP:
- spin_lock_irqsave(&bus->reg_lock, cookie);
- snd_hdac_stream_stop(hdac_stream(host_stream));
- spin_unlock_irqrestore(&bus->reg_lock, cookie);
+ scoped_guard(spinlock_irqsave, &bus->reg_lock)
+ snd_hdac_stream_stop(hdac_stream(host_stream));
break;
default:
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* Re: [PATCH 04/20] ASoC: Intel: avs: probes: Use guard() for spin locks
2026-06-11 11:58 ` [PATCH 04/20] ASoC: Intel: avs: probes: Use guard() for spin locks phucduc.bui
@ 2026-06-11 19:34 ` Cezary Rojewski
0 siblings, 0 replies; 25+ messages in thread
From: Cezary Rojewski @ 2026-06-11 19:34 UTC (permalink / raw)
To: phucduc.bui
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
Mark Brown, Liam Girdwood
On 6/11/2026 1:58 PM, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Clean up the code using guard() for spin locks.
> Merely code refactoring, and no behavior change.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
> sound/soc/intel/avs/probes.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/sound/soc/intel/avs/probes.c b/sound/soc/intel/avs/probes.c
> index 099119ad28b3..13d933ab77cd 100644
> --- a/sound/soc/intel/avs/probes.c
> +++ b/sound/soc/intel/avs/probes.c
> @@ -186,7 +186,6 @@ static int avs_probe_compr_trigger(struct snd_compr_stream *cstream, int cmd,
> struct hdac_ext_stream *host_stream = avs_compr_get_host_stream(cstream);
> struct avs_dev *adev = to_avs_dev(dai->dev);
> struct hdac_bus *bus = &adev->base.core;
> - unsigned long cookie;
>
> if (!hdac_stream(host_stream)->prepared)
> return -EPIPE;
> @@ -195,17 +194,15 @@ static int avs_probe_compr_trigger(struct snd_compr_stream *cstream, int cmd,
> case SNDRV_PCM_TRIGGER_START:
> case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
> case SNDRV_PCM_TRIGGER_RESUME:
> - spin_lock_irqsave(&bus->reg_lock, cookie);
> - snd_hdac_stream_start(hdac_stream(host_stream));
> - spin_unlock_irqrestore(&bus->reg_lock, cookie);
> + scoped_guard(spinlock_irqsave, &bus->reg_lock)
> + snd_hdac_stream_start(hdac_stream(host_stream));
Well, maybe one patch per driver suggestion of mine was a little too
much.. Let's separate guard() changes from scoped_guard() ones.
guard()s carry no readability cost.
I'm not a fan of scoped_guard() update for any existing code block that
looks like below:
lock()
one_liner()
unlock()
Adding tab to the picture ruins readability. The cost of tab is OK if
there are more operations between the locking/unlocking though.
> break;
>
> case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
> case SNDRV_PCM_TRIGGER_SUSPEND:
> case SNDRV_PCM_TRIGGER_STOP:
> - spin_lock_irqsave(&bus->reg_lock, cookie);
> - snd_hdac_stream_stop(hdac_stream(host_stream));
> - spin_unlock_irqrestore(&bus->reg_lock, cookie);
> + scoped_guard(spinlock_irqsave, &bus->reg_lock)
> + snd_hdac_stream_stop(hdac_stream(host_stream));
> break;
>
> default:
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 05/20] ASoC: Intel: avs: pcm: Use guard() for mutex & spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (3 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 04/20] ASoC: Intel: avs: probes: Use guard() for spin locks phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 06/20] ASoC: Intel: avs: path: " phucduc.bui
` (15 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex & spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/pcm.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index 797b9c9163b4..931b74c60a36 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -864,7 +864,6 @@ static int avs_dai_fe_trigger(struct snd_pcm_substream *substream, int cmd, stru
struct avs_dma_data *data;
struct hdac_ext_stream *host_stream;
struct hdac_bus *bus;
- unsigned long flags;
int ret = 0;
data = snd_soc_dai_get_dma_data(dai, substream);
@@ -878,9 +877,8 @@ static int avs_dai_fe_trigger(struct snd_pcm_substream *substream, int cmd, stru
fallthrough;
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- spin_lock_irqsave(&bus->reg_lock, flags);
- avs_hda_stream_start(bus, host_stream);
- spin_unlock_irqrestore(&bus->reg_lock, flags);
+ scoped_guard(spinlock_irqsave, &bus->reg_lock)
+ avs_hda_stream_start(bus, host_stream);
/* Timeout on DRSM poll shall not stop the resume so ignore the result. */
if (cmd == SNDRV_PCM_TRIGGER_RESUME)
@@ -908,9 +906,8 @@ static int avs_dai_fe_trigger(struct snd_pcm_substream *substream, int cmd, stru
if (ret < 0)
dev_err(dai->dev, "pause FE path failed: %d\n", ret);
- spin_lock_irqsave(&bus->reg_lock, flags);
- avs_hda_stream_stop(bus, host_stream);
- spin_unlock_irqrestore(&bus->reg_lock, flags);
+ scoped_guard(spinlock_irqsave, &bus->reg_lock)
+ avs_hda_stream_stop(bus, host_stream);
ret = avs_path_reset(data->path);
if (ret < 0)
@@ -1052,9 +1049,8 @@ static int avs_component_probe(struct snd_soc_component *component)
debugfs_create_file("topology_name", 0444, component->debugfs_root, component,
&topology_name_fops);
- mutex_lock(&adev->comp_list_mutex);
- list_add_tail(&acomp->node, &adev->comp_list);
- mutex_unlock(&adev->comp_list_mutex);
+ scoped_guard(mutex, &adev->comp_list_mutex)
+ list_add_tail(&acomp->node, &adev->comp_list);
return 0;
@@ -1072,9 +1068,8 @@ static void avs_component_remove(struct snd_soc_component *component)
mach = dev_get_platdata(component->card->dev);
- mutex_lock(&adev->comp_list_mutex);
- list_del(&acomp->node);
- mutex_unlock(&adev->comp_list_mutex);
+ scoped_guard(mutex, &adev->comp_list_mutex)
+ list_del(&acomp->node);
if (mach->tplg_filename) {
ret = avs_remove_topology(component);
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 06/20] ASoC: Intel: avs: path: Use guard() for mutex & spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (4 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 05/20] ASoC: Intel: avs: pcm: Use guard() for mutex & " phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 07/20] ASoC: Intel: avs: loader: Use guard() for mutex locks phucduc.bui
` (14 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex & spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/path.c | 39 ++++++++++++--------------------------
1 file changed, 12 insertions(+), 27 deletions(-)
diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index 2291f9728a54..4f78df93a24d 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -69,16 +69,13 @@ avs_path_find_path(struct avs_dev *adev, const char *name, u32 template_id)
if (!template)
return NULL;
- spin_lock(&adev->path_list_lock);
+ guard(spinlock)(&adev->path_list_lock);
/* Only one variant of given path template may be instantiated at a time. */
list_for_each_entry(path, &adev->path_list, node) {
- if (path->template->owner == template) {
- spin_unlock(&adev->path_list_lock);
+ if (path->template->owner == template)
return path;
- }
}
- spin_unlock(&adev->path_list_lock);
return NULL;
}
@@ -1121,9 +1118,8 @@ static int avs_path_init(struct avs_dev *adev, struct avs_path *path,
list_add_tail(&ppl->node, &path->ppl_list);
}
- spin_lock(&adev->path_list_lock);
- list_add_tail(&path->node, &adev->path_list);
- spin_unlock(&adev->path_list_lock);
+ scoped_guard(spinlock, &adev->path_list_lock)
+ list_add_tail(&path->node, &adev->path_list);
return 0;
}
@@ -1157,9 +1153,8 @@ static void avs_path_free_unlocked(struct avs_path *path)
{
struct avs_path_pipeline *ppl, *save;
- spin_lock(&path->owner->path_list_lock);
- list_del(&path->node);
- spin_unlock(&path->owner->path_list_lock);
+ scoped_guard(spinlock, &path->owner->path_list_lock)
+ list_del(&path->node);
list_for_each_entry_safe(ppl, save, &path->ppl_list, node)
avs_path_pipeline_free(path->owner, ppl);
@@ -1305,7 +1300,7 @@ void avs_path_free(struct avs_path *path)
struct avs_path *cpath, *csave;
struct avs_dev *adev = path->owner;
- mutex_lock(&adev->path_mutex);
+ guard(mutex)(&adev->path_mutex);
/* Free all condpaths this path spawned. */
list_for_each_entry_safe(cpath, csave, &path->source_list, source_node)
@@ -1314,8 +1309,6 @@ void avs_path_free(struct avs_path *path)
avs_condpath_free(path->owner, cpath);
avs_path_free_unlocked(path);
-
- mutex_unlock(&adev->path_mutex);
}
struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id,
@@ -1334,13 +1327,13 @@ struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id,
}
/* Serialize path and its components creation. */
- mutex_lock(&adev->path_mutex);
+ guard(mutex)(&adev->path_mutex);
/* Satisfy needs of avs_path_find_tplg(). */
- mutex_lock(&adev->comp_list_mutex);
+ guard(mutex)(&adev->comp_list_mutex);
path = avs_path_create_unlocked(adev, dma_id, variant);
if (IS_ERR(path))
- goto exit;
+ return path;
ret = avs_condpaths_walk_all(adev, path);
if (ret) {
@@ -1348,10 +1341,6 @@ struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id,
path = ERR_PTR(ret);
}
-exit:
- mutex_unlock(&adev->comp_list_mutex);
- mutex_unlock(&adev->path_mutex);
-
return path;
}
@@ -1496,15 +1485,13 @@ static void avs_condpaths_pause(struct avs_dev *adev, struct avs_path *path)
{
struct avs_path *cpath;
- mutex_lock(&adev->path_mutex);
+ guard(mutex)(&adev->path_mutex);
/* If either source or sink stops, so do the attached conditional paths. */
list_for_each_entry(cpath, &path->source_list, source_node)
avs_condpath_pause(adev, cpath);
list_for_each_entry(cpath, &path->sink_list, sink_node)
avs_condpath_pause(adev, cpath);
-
- mutex_unlock(&adev->path_mutex);
}
int avs_path_pause(struct avs_path *path)
@@ -1560,7 +1547,7 @@ static void avs_condpaths_run(struct avs_dev *adev, struct avs_path *path, int t
{
struct avs_path *cpath;
- mutex_lock(&adev->path_mutex);
+ guard(mutex)(&adev->path_mutex);
/* Run conditional paths only if source and sink are both running. */
list_for_each_entry(cpath, &path->source_list, source_node)
@@ -1572,8 +1559,6 @@ static void avs_condpaths_run(struct avs_dev *adev, struct avs_path *path, int t
if (cpath->source->state == AVS_PPL_STATE_RUNNING &&
cpath->sink->state == AVS_PPL_STATE_RUNNING)
avs_condpath_run(adev, cpath, trigger);
-
- mutex_unlock(&adev->path_mutex);
}
int avs_path_run(struct avs_path *path, int trigger)
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 07/20] ASoC: Intel: avs: loader: Use guard() for mutex locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (5 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 06/20] ASoC: Intel: avs: path: " phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 08/20] ASoC: Intel: avs: ipc: Use guard() for mutex & spin locks phucduc.bui
` (13 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/loader.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/soc/intel/avs/loader.c b/sound/soc/intel/avs/loader.c
index 353e343b1d28..3b158039acb2 100644
--- a/sound/soc/intel/avs/loader.c
+++ b/sound/soc/intel/avs/loader.c
@@ -630,15 +630,15 @@ static int avs_load_firmware(struct avs_dev *adev, bool purge)
if (ret)
goto reenable_gating;
- mutex_lock(&adev->comp_list_mutex);
- list_for_each_entry(acomp, &adev->comp_list, node) {
- struct avs_tplg *tplg = acomp->tplg;
+ scoped_guard(mutex, &adev->comp_list_mutex) {
+ list_for_each_entry(acomp, &adev->comp_list, node) {
+ struct avs_tplg *tplg = acomp->tplg;
- ret = avs_dsp_load_libraries(adev, tplg->libs, tplg->num_libs);
- if (ret < 0)
- break;
+ ret = avs_dsp_load_libraries(adev, tplg->libs, tplg->num_libs);
+ if (ret < 0)
+ break;
+ }
}
- mutex_unlock(&adev->comp_list_mutex);
reenable_gating:
avs_hda_l1sen_enable(adev, true);
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 08/20] ASoC: Intel: avs: ipc: Use guard() for mutex & spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (6 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 07/20] ASoC: Intel: avs: loader: Use guard() for mutex locks phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 09/20] ASoC: Intel: avs: icl: Use guard() for " phucduc.bui
` (12 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex & spin locks.
Additionally, simplify avs_ipc_wait_busy_completion()
while converting the locking code.
No functional change intended.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/ipc.c | 105 ++++++++++++++++++--------------------
1 file changed, 49 insertions(+), 56 deletions(-)
diff --git a/sound/soc/intel/avs/ipc.c b/sound/soc/intel/avs/ipc.c
index c0feb9edd7f6..0dae36c83678 100644
--- a/sound/soc/intel/avs/ipc.c
+++ b/sound/soc/intel/avs/ipc.c
@@ -99,39 +99,39 @@ static void avs_dsp_recovery(struct avs_dev *adev)
unsigned int core_mask;
int ret;
- mutex_lock(&adev->comp_list_mutex);
- /* disconnect all running streams */
- list_for_each_entry(acomp, &adev->comp_list, node) {
- struct snd_soc_pcm_runtime *rtd;
- struct snd_soc_card *card;
-
- card = acomp->base.card;
- if (!card)
- continue;
-
- for_each_card_rtds(card, rtd) {
- struct snd_pcm *pcm;
- int dir;
-
- pcm = rtd->pcm;
- if (!pcm || rtd->dai_link->no_pcm)
+ scoped_guard(mutex, &adev->comp_list_mutex) {
+ /* disconnect all running streams */
+ list_for_each_entry(acomp, &adev->comp_list, node) {
+ struct snd_soc_pcm_runtime *rtd;
+ struct snd_soc_card *card;
+
+ card = acomp->base.card;
+ if (!card)
continue;
- for_each_pcm_streams(dir) {
- struct snd_pcm_substream *substream;
+ for_each_card_rtds(card, rtd) {
+ struct snd_pcm *pcm;
+ int dir;
- substream = pcm->streams[dir].substream;
- if (!substream || !substream->runtime)
+ pcm = rtd->pcm;
+ if (!pcm || rtd->dai_link->no_pcm)
continue;
- /* No need for _irq() as we are in nonatomic context. */
- snd_pcm_stream_lock(substream);
- snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
- snd_pcm_stream_unlock(substream);
+ for_each_pcm_streams(dir) {
+ struct snd_pcm_substream *substream;
+
+ substream = pcm->streams[dir].substream;
+ if (!substream || !substream->runtime)
+ continue;
+
+ /* No need for _irq() as we are in nonatomic context. */
+ snd_pcm_stream_lock(substream);
+ snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
+ snd_pcm_stream_unlock(substream);
+ }
}
}
}
- mutex_unlock(&adev->comp_list_mutex);
/* forcibly shutdown all cores */
core_mask = GENMASK(adev->hw_cfg.dsp_cores - 1, 0);
@@ -294,10 +294,10 @@ void avs_dsp_process_response(struct avs_dev *adev, u64 header)
*/
if (avs_msg_is_reply(header)) {
/* Response processing is invoked from IRQ thread. */
- spin_lock_irq(&ipc->rx_lock);
- avs_dsp_receive_rx(adev, header);
- ipc->rx_completed = true;
- spin_unlock_irq(&ipc->rx_lock);
+ scoped_guard(spinlock_irq, &ipc->rx_lock) {
+ avs_dsp_receive_rx(adev, header);
+ ipc->rx_completed = true;
+ }
} else {
avs_dsp_process_notification(adev, header);
}
@@ -338,21 +338,18 @@ static int avs_ipc_wait_busy_completion(struct avs_ipc *ipc, int timeout)
}
/* Ongoing notification's bottom-half may cause early wakeup */
- spin_lock(&ipc->rx_lock);
- if (!ipc->rx_completed) {
- if (repeats_left) {
+ scoped_guard(spinlock, &ipc->rx_lock) {
+ if (!ipc->rx_completed) {
+ if (!repeats_left)
+ return -ETIMEDOUT;
+
/* Reply delayed due to notification. */
repeats_left--;
reinit_completion(&ipc->busy_completion);
- spin_unlock(&ipc->rx_lock);
goto again;
}
-
- spin_unlock(&ipc->rx_lock);
- return -ETIMEDOUT;
}
- spin_unlock(&ipc->rx_lock);
return 0;
}
@@ -397,12 +394,12 @@ static int avs_dsp_do_send_msg(struct avs_dev *adev, struct avs_ipc_msg *request
if (!ipc->ready)
return -EPERM;
- mutex_lock(&ipc->msg_mutex);
+ guard(mutex)(&ipc->msg_mutex);
- spin_lock(&ipc->rx_lock);
- avs_ipc_msg_init(ipc, reply);
- avs_dsp_send_tx(adev, request, true);
- spin_unlock(&ipc->rx_lock);
+ scoped_guard(spinlock, &ipc->rx_lock) {
+ avs_ipc_msg_init(ipc, reply);
+ avs_dsp_send_tx(adev, request, true);
+ }
ret = avs_ipc_wait_busy_completion(ipc, timeout);
if (ret) {
@@ -412,7 +409,7 @@ static int avs_dsp_do_send_msg(struct avs_dev *adev, struct avs_ipc_msg *request
/* Same treatment as on exception, just stack_dump=0. */
avs_dsp_exception_caught(adev, &msg);
}
- goto exit;
+ return ret;
}
ret = ipc->rx.rsp.status;
@@ -436,8 +433,6 @@ static int avs_dsp_do_send_msg(struct avs_dev *adev, struct avs_ipc_msg *request
memcpy(reply->data, ipc->rx.data, reply->size);
}
-exit:
- mutex_unlock(&ipc->msg_mutex);
return ret;
}
@@ -501,16 +496,16 @@ static int avs_dsp_do_send_rom_msg(struct avs_dev *adev, struct avs_ipc_msg *req
struct avs_ipc *ipc = adev->ipc;
int ret;
- mutex_lock(&ipc->msg_mutex);
+ guard(mutex)(&ipc->msg_mutex);
- spin_lock(&ipc->rx_lock);
- avs_ipc_msg_init(ipc, NULL);
- /*
- * with hw still stalled, memory windows may not be
- * configured properly so avoid accessing SRAM
- */
- avs_dsp_send_tx(adev, request, false);
- spin_unlock(&ipc->rx_lock);
+ scoped_guard(spinlock, &ipc->rx_lock) {
+ avs_ipc_msg_init(ipc, NULL);
+ /*
+ * with hw still stalled, memory windows may not be
+ * configured properly so avoid accessing SRAM
+ */
+ avs_dsp_send_tx(adev, request, false);
+ }
/* ROM messages must be sent before main core is unstalled */
ret = avs_dsp_op(adev, stall, AVS_MAIN_CORE_MASK, false);
@@ -522,8 +517,6 @@ static int avs_dsp_do_send_rom_msg(struct avs_dev *adev, struct avs_ipc_msg *req
dev_err(adev->dev, "%s (0x%08x 0x%08x) failed: %d\n",
name, request->glb.primary, request->glb.ext.val, ret);
- mutex_unlock(&ipc->msg_mutex);
-
return ret;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 09/20] ASoC: Intel: avs: icl: Use guard() for spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (7 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 08/20] ASoC: Intel: avs: ipc: Use guard() for mutex & spin locks phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 10/20] ASoC: Intel: avs: debugfs: " phucduc.bui
` (11 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/icl.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/intel/avs/icl.c b/sound/soc/intel/avs/icl.c
index d655e727bebd..4d425846b56e 100644
--- a/sound/soc/intel/avs/icl.c
+++ b/sound/soc/intel/avs/icl.c
@@ -166,15 +166,13 @@ int avs_icl_load_basefw(struct avs_dev *adev, struct firmware *fw)
snd_hdac_chip_updateb(bus, VS_LTRP, AZX_REG_VS_LTRP_GB_MASK, ICL_VS_LTRP_GB_ICCMAX);
- spin_lock(&bus->reg_lock);
- snd_hdac_stream_start(hdac_stream(host_stream));
- spin_unlock(&bus->reg_lock);
+ scoped_guard(spinlock, &bus->reg_lock)
+ snd_hdac_stream_start(hdac_stream(host_stream));
ret = avs_hda_load_basefw(adev, fw);
- spin_lock(&bus->reg_lock);
- snd_hdac_stream_stop(hdac_stream(host_stream));
- spin_unlock(&bus->reg_lock);
+ scoped_guard(spinlock, &bus->reg_lock)
+ snd_hdac_stream_stop(hdac_stream(host_stream));
snd_hdac_dsp_cleanup(hdac_stream(host_stream), &dmab);
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 10/20] ASoC: Intel: avs: debugfs: Use guard() for spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (8 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 09/20] ASoC: Intel: avs: icl: Use guard() for " phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 11/20] ASoC: Intel: avs: debug: " phucduc.bui
` (10 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/debugfs.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/sound/soc/intel/avs/debugfs.c b/sound/soc/intel/avs/debugfs.c
index 701c247227bf..f398ebd68e13 100644
--- a/sound/soc/intel/avs/debugfs.c
+++ b/sound/soc/intel/avs/debugfs.c
@@ -251,24 +251,22 @@ static int strace_release(struct inode *inode, struct file *file)
union avs_notify_msg msg = AVS_NOTIFICATION(LOG_BUFFER_STATUS);
struct avs_dev *adev = file->private_data;
unsigned long resource_mask;
- unsigned long flags, i;
+ unsigned long i;
u32 num_cores;
resource_mask = adev->logged_resources;
num_cores = adev->hw_cfg.dsp_cores;
- spin_lock_irqsave(&adev->trace_lock, flags);
+ scoped_guard(spinlock_irqsave, &adev->trace_lock) {
+ /* Gather any remaining logs. */
+ for_each_set_bit(i, &resource_mask, num_cores) {
+ msg.log.core = i;
+ avs_dsp_op(adev, log_buffer_status, &msg);
+ }
- /* Gather any remaining logs. */
- for_each_set_bit(i, &resource_mask, num_cores) {
- msg.log.core = i;
- avs_dsp_op(adev, log_buffer_status, &msg);
+ kfifo_free(&adev->trace_fifo);
}
- kfifo_free(&adev->trace_fifo);
-
- spin_unlock_irqrestore(&adev->trace_lock, flags);
-
module_put(adev->dev->driver->owner);
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 11/20] ASoC: Intel: avs: debug: Use guard() for spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (9 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 10/20] ASoC: Intel: avs: debugfs: " phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 12/20] ASoC: Intel: avs: core: Use guard() for mutex & " phucduc.bui
` (9 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/debug.h | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/sound/soc/intel/avs/debug.h b/sound/soc/intel/avs/debug.h
index 94fe8729a5c1..7c5f97b46f0d 100644
--- a/sound/soc/intel/avs/debug.h
+++ b/sound/soc/intel/avs/debug.h
@@ -26,14 +26,9 @@ struct avs_dev;
static inline int avs_log_buffer_status_locked(struct avs_dev *adev, union avs_notify_msg *msg)
{
- unsigned long flags;
- int ret;
+ guard(spinlock_irqsave)(&adev->trace_lock);
- spin_lock_irqsave(&adev->trace_lock, flags);
- ret = avs_dsp_op(adev, log_buffer_status, msg);
- spin_unlock_irqrestore(&adev->trace_lock, flags);
-
- return ret;
+ return avs_dsp_op(adev, log_buffer_status, msg);
}
struct avs_apl_log_buffer_layout {
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 12/20] ASoC: Intel: avs: core: Use guard() for mutex & spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (10 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 11/20] ASoC: Intel: avs: debug: " phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 13/20] ASoC: Intel: avs: control: Use guard() for " phucduc.bui
` (8 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex & spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/core.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c
index 1a53856c2ffb..894981cae94b 100644
--- a/sound/soc/intel/avs/core.c
+++ b/sound/soc/intel/avs/core.c
@@ -135,10 +135,10 @@ static int probe_codec(struct hdac_bus *bus, int addr)
unsigned int res = -1;
int ret;
- mutex_lock(&bus->cmd_mutex);
- snd_hdac_bus_send_cmd(bus, cmd);
- snd_hdac_bus_get_response(bus, addr, &res);
- mutex_unlock(&bus->cmd_mutex);
+ scoped_guard(mutex, &bus->cmd_mutex) {
+ snd_hdac_bus_send_cmd(bus, cmd);
+ snd_hdac_bus_get_response(bus, addr, &res);
+ }
if (res == -1)
return -EIO;
@@ -273,7 +273,7 @@ static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus)
if (snd_hdac_bus_handle_stream_irq(bus, status, hdac_update_stream))
ret = IRQ_HANDLED;
- spin_lock_irq(&bus->reg_lock);
+ guard(spinlock_irq)(&bus->reg_lock);
/* Clear RIRB interrupt. */
status = snd_hdac_chip_readb(bus, RIRBSTS);
if (status & RIRB_INT_MASK) {
@@ -283,7 +283,6 @@ static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus)
ret = IRQ_HANDLED;
}
- spin_unlock_irq(&bus->reg_lock);
return ret;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 13/20] ASoC: Intel: avs: control: Use guard() for spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (11 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 12/20] ASoC: Intel: avs: core: Use guard() for mutex & " phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 14/20] ASoC: Intel: avs: apl: " phucduc.bui
` (7 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/control.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/sound/soc/intel/avs/control.c b/sound/soc/intel/avs/control.c
index a8f05de338e0..370069247a7d 100644
--- a/sound/soc/intel/avs/control.c
+++ b/sound/soc/intel/avs/control.c
@@ -27,7 +27,7 @@ static struct avs_path_module *avs_get_volume_module(struct avs_dev *adev, u32 i
struct avs_path_pipeline *ppl;
struct avs_path_module *mod;
- spin_lock(&adev->path_list_lock);
+ guard(spinlock)(&adev->path_list_lock);
list_for_each_entry(path, &adev->path_list, node) {
list_for_each_entry(ppl, &path->ppl_list, node) {
list_for_each_entry(mod, &ppl->mod_list, node) {
@@ -35,14 +35,11 @@ static struct avs_path_module *avs_get_volume_module(struct avs_dev *adev, u32 i
if ((guid_equal(type, &AVS_PEAKVOL_MOD_UUID) ||
guid_equal(type, &AVS_GAIN_MOD_UUID)) &&
- mod->template->ctl_id == id) {
- spin_unlock(&adev->path_list_lock);
+ mod->template->ctl_id == id)
return mod;
- }
}
}
}
- spin_unlock(&adev->path_list_lock);
return NULL;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 14/20] ASoC: Intel: avs: apl: Use guard() for spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (12 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 13/20] ASoC: Intel: avs: control: Use guard() for " phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 15/20] ASoC: Intel: atom: sst_stream: Use guard() for mutex locks phucduc.bui
` (6 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/avs/apl.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/sound/soc/intel/avs/apl.c b/sound/soc/intel/avs/apl.c
index b922eeaba843..e92a6157fed1 100644
--- a/sound/soc/intel/avs/apl.c
+++ b/sound/soc/intel/avs/apl.c
@@ -190,7 +190,7 @@ static bool avs_apl_lp_streaming(struct avs_dev *adev)
{
struct avs_path *path;
- spin_lock(&adev->path_list_lock);
+ guard(spinlock)(&adev->path_list_lock);
/* Any gateway without buffer allocated in LP area disqualifies D0IX. */
list_for_each_entry(path, &adev->path_list, node) {
struct avs_path_pipeline *ppl;
@@ -210,14 +210,11 @@ static bool avs_apl_lp_streaming(struct avs_dev *adev)
if (cfg->copier.dma_type == INVALID_OBJECT_ID)
continue;
- if (!mod->gtw_attrs.lp_buffer_alloc) {
- spin_unlock(&adev->path_list_lock);
+ if (!mod->gtw_attrs.lp_buffer_alloc)
return false;
- }
}
}
}
- spin_unlock(&adev->path_list_lock);
return true;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 15/20] ASoC: Intel: atom: sst_stream: Use guard() for mutex locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (13 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 14/20] ASoC: Intel: avs: apl: " phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 16/20] ASoC: Intel: atom: sst_pvt: Use guard() for mutex & spin locks phucduc.bui
` (5 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex locks.
Additionally, simplify sst_free_stream() while
converting the locking code.
No functional change intended.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/atom/sst/sst_stream.c | 52 ++++++++++++---------------
1 file changed, 23 insertions(+), 29 deletions(-)
diff --git a/sound/soc/intel/atom/sst/sst_stream.c b/sound/soc/intel/atom/sst/sst_stream.c
index 288221db7323..d2d6ed6df661 100644
--- a/sound/soc/intel/atom/sst/sst_stream.c
+++ b/sound/soc/intel/atom/sst/sst_stream.c
@@ -265,9 +265,8 @@ int sst_pause_stream(struct intel_sst_drv *sst_drv_ctx, int str_id)
str_info->status = STREAM_PAUSED;
} else if (retval == -SST_ERR_INVALID_STREAM_ID) {
retval = -EINVAL;
- mutex_lock(&sst_drv_ctx->sst_lock);
- sst_clean_stream(str_info);
- mutex_unlock(&sst_drv_ctx->sst_lock);
+ scoped_guard(mutex, &sst_drv_ctx->sst_lock)
+ sst_clean_stream(str_info);
}
} else {
retval = -EBADRQC;
@@ -332,9 +331,8 @@ int sst_resume_stream(struct intel_sst_drv *sst_drv_ctx, int str_id)
str_info->prev = STREAM_PAUSED;
} else if (retval == -SST_ERR_INVALID_STREAM_ID) {
retval = -EINVAL;
- mutex_lock(&sst_drv_ctx->sst_lock);
- sst_clean_stream(str_info);
- mutex_unlock(&sst_drv_ctx->sst_lock);
+ scoped_guard(mutex, &sst_drv_ctx->sst_lock)
+ sst_clean_stream(str_info);
}
} else {
retval = -EBADRQC;
@@ -433,39 +431,35 @@ int sst_free_stream(struct intel_sst_drv *sst_drv_ctx, int str_id)
dev_dbg(sst_drv_ctx->dev, "SST DBG:sst_free_stream for %d\n", str_id);
- mutex_lock(&sst_drv_ctx->sst_lock);
- if (sst_drv_ctx->sst_state == SST_RESET) {
- mutex_unlock(&sst_drv_ctx->sst_lock);
- return -ENODEV;
+ scoped_guard(mutex, &sst_drv_ctx->sst_lock) {
+ if (sst_drv_ctx->sst_state == SST_RESET)
+ return -ENODEV;
}
- mutex_unlock(&sst_drv_ctx->sst_lock);
str_info = get_stream_info(sst_drv_ctx, str_id);
if (!str_info)
return -EINVAL;
- mutex_lock(&str_info->lock);
- if (str_info->status != STREAM_UN_INIT) {
+ scoped_guard(mutex, &str_info->lock) {
+ if (str_info->status == STREAM_UN_INIT) {
+ dev_dbg(sst_drv_ctx->dev, "SST DBG:BADQRC for stream\n");
+ return -EBADRQC;
+ }
str_info->prev = str_info->status;
str_info->status = STREAM_UN_INIT;
- mutex_unlock(&str_info->lock);
+ }
- dev_dbg(sst_drv_ctx->dev, "Free for str %d pipe %#x\n",
- str_id, str_info->pipe_id);
- retval = sst_prepare_and_post_msg(sst_drv_ctx, str_info->task_id, IPC_CMD,
- IPC_IA_FREE_STREAM_MRFLD, str_info->pipe_id, 0,
- NULL, NULL, true, true, false, true);
+ dev_dbg(sst_drv_ctx->dev, "Free for str %d pipe %#x\n", str_id, str_info->pipe_id);
+
+ retval = sst_prepare_and_post_msg(sst_drv_ctx, str_info->task_id, IPC_CMD,
+ IPC_IA_FREE_STREAM_MRFLD, str_info->pipe_id, 0,
+ NULL, NULL, true, true, false, true);
+
+ dev_dbg(sst_drv_ctx->dev, "sst: wait for free returned %d\n", retval);
- dev_dbg(sst_drv_ctx->dev, "sst: wait for free returned %d\n",
- retval);
- mutex_lock(&sst_drv_ctx->sst_lock);
+ scoped_guard(mutex, &sst_drv_ctx->sst_lock)
sst_clean_stream(str_info);
- mutex_unlock(&sst_drv_ctx->sst_lock);
- dev_dbg(sst_drv_ctx->dev, "SST DBG:Stream freed\n");
- } else {
- mutex_unlock(&str_info->lock);
- retval = -EBADRQC;
- dev_dbg(sst_drv_ctx->dev, "SST DBG:BADQRC for stream\n");
- }
+
+ dev_dbg(sst_drv_ctx->dev, "SST DBG:Stream freed\n");
return retval;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 16/20] ASoC: Intel: atom: sst_pvt: Use guard() for mutex & spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (14 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 15/20] ASoC: Intel: atom: sst_stream: Use guard() for mutex locks phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 17/20] ASoC: Intel: atom: sst: Use guard() for " phucduc.bui
` (4 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex & spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/atom/sst/sst_pvt.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/sound/soc/intel/atom/sst/sst_pvt.c b/sound/soc/intel/atom/sst/sst_pvt.c
index 67b1ab14239f..e5b7c5646659 100644
--- a/sound/soc/intel/atom/sst/sst_pvt.c
+++ b/sound/soc/intel/atom/sst/sst_pvt.c
@@ -64,9 +64,8 @@ u64 sst_shim_read64(void __iomem *addr, int offset)
void sst_set_fw_state_locked(
struct intel_sst_drv *sst_drv_ctx, int sst_state)
{
- mutex_lock(&sst_drv_ctx->sst_lock);
+ guard(mutex)(&sst_drv_ctx->sst_lock);
sst_drv_ctx->sst_state = sst_state;
- mutex_unlock(&sst_drv_ctx->sst_lock);
}
/*
@@ -179,9 +178,8 @@ void sst_clean_stream(struct stream_info *stream)
{
stream->status = STREAM_UN_INIT;
stream->prev = STREAM_UN_INIT;
- mutex_lock(&stream->lock);
- stream->cumm_bytes = 0;
- mutex_unlock(&stream->lock);
+ scoped_guard(mutex, &stream->lock)
+ stream->cumm_bytes = 0;
}
int sst_prepare_and_post_msg(struct intel_sst_drv *sst,
@@ -302,18 +300,17 @@ int sst_assign_pvt_id(struct intel_sst_drv *drv)
{
int local;
- spin_lock(&drv->block_lock);
+ guard(spinlock)(&drv->block_lock);
/* find first zero index from lsb */
local = ffz(drv->pvt_id);
dev_dbg(drv->dev, "pvt_id assigned --> %d\n", local);
if (local >= SST_MAX_BLOCKS){
- spin_unlock(&drv->block_lock);
dev_err(drv->dev, "PVT _ID error: no free id blocks ");
return -EINVAL;
}
/* toggle the index */
change_bit(local, &drv->pvt_id);
- spin_unlock(&drv->block_lock);
+
return local;
}
@@ -363,10 +360,8 @@ EXPORT_SYMBOL_GPL(relocate_imr_addr_mrfld);
void sst_add_to_dispatch_list_and_post(struct intel_sst_drv *sst,
struct ipc_post *msg)
{
- unsigned long irq_flags;
+ scoped_guard(spinlock_irqsave, &sst->ipc_spin_lock)
+ list_add_tail(&msg->node, &sst->ipc_dispatch_list);
- spin_lock_irqsave(&sst->ipc_spin_lock, irq_flags);
- list_add_tail(&msg->node, &sst->ipc_dispatch_list);
- spin_unlock_irqrestore(&sst->ipc_spin_lock, irq_flags);
sst->ops->post_message(sst, NULL, false);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 17/20] ASoC: Intel: atom: sst: Use guard() for spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (15 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 16/20] ASoC: Intel: atom: sst_pvt: Use guard() for mutex & spin locks phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:58 ` [PATCH 18/20] ASoC: Intel: atom: sst-atom-controls: Use guard() for mutex locks phucduc.bui
` (3 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/atom/sst/sst.c | 37 +++++++++++++++++-----------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c
index d9d695ed7cfb..7af76188db3e 100644
--- a/sound/soc/intel/atom/sst/sst.c
+++ b/sound/soc/intel/atom/sst/sst.c
@@ -57,17 +57,17 @@ static irqreturn_t intel_sst_interrupt_mrfld(int irq, void *context)
isr.full = sst_shim_read64(drv->shim, SST_ISRX);
if (isr.part.done_interrupt) {
- /* Clear done bit */
- spin_lock(&drv->ipc_spin_lock);
- header.full = sst_shim_read64(drv->shim,
- drv->ipc_reg.ipcx);
- header.p.header_high.part.done = 0;
- sst_shim_write64(drv->shim, drv->ipc_reg.ipcx, header.full);
-
- /* write 1 to clear status register */
- isr.part.done_interrupt = 1;
- sst_shim_write64(drv->shim, SST_ISRX, isr.full);
- spin_unlock(&drv->ipc_spin_lock);
+ scoped_guard(spinlock, &drv->ipc_spin_lock) {
+ /* Clear done bit */
+ header.full = sst_shim_read64(drv->shim,
+ drv->ipc_reg.ipcx);
+ header.p.header_high.part.done = 0;
+ sst_shim_write64(drv->shim, drv->ipc_reg.ipcx, header.full);
+
+ /* write 1 to clear status register */
+ isr.part.done_interrupt = 1;
+ sst_shim_write64(drv->shim, SST_ISRX, isr.full);
+ }
/* we can send more messages to DSP so trigger work */
queue_work(drv->post_msg_wq, &drv->ipc_post_msg_wq);
@@ -76,11 +76,11 @@ static irqreturn_t intel_sst_interrupt_mrfld(int irq, void *context)
if (isr.part.busy_interrupt) {
/* message from dsp so copy that */
- spin_lock(&drv->ipc_spin_lock);
- imr.full = sst_shim_read64(drv->shim, SST_IMRX);
- imr.part.busy_interrupt = 1;
- sst_shim_write64(drv->shim, SST_IMRX, imr.full);
- spin_unlock(&drv->ipc_spin_lock);
+ scoped_guard(spinlock, &drv->ipc_spin_lock) {
+ imr.full = sst_shim_read64(drv->shim, SST_IMRX);
+ imr.part.busy_interrupt = 1;
+ sst_shim_write64(drv->shim, SST_IMRX, imr.full);
+ }
header.full = sst_shim_read64(drv->shim, drv->ipc_reg.ipcd);
if (sst_create_ipc_msg(&msg, header.p.header_high.part.large)) {
@@ -103,9 +103,8 @@ static irqreturn_t intel_sst_interrupt_mrfld(int irq, void *context)
msg->mrfld_header = header;
msg->is_process_reply =
sst_is_process_reply(header.p.header_high.part.msg_id);
- spin_lock(&drv->rx_msg_lock);
- list_add_tail(&msg->node, &drv->rx_list);
- spin_unlock(&drv->rx_msg_lock);
+ scoped_guard(spinlock, &drv->rx_msg_lock)
+ list_add_tail(&msg->node, &drv->rx_list);
drv->ops->clear_interrupt(drv);
retval = IRQ_WAKE_THREAD;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 18/20] ASoC: Intel: atom: sst-atom-controls: Use guard() for mutex locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (16 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 17/20] ASoC: Intel: atom: sst: Use guard() for " phucduc.bui
@ 2026-06-11 11:58 ` phucduc.bui
2026-06-11 11:59 ` [PATCH 19/20] ASoC: Intel: atom: sst-mfld-platform-pcm: Use guard() for mutex & spin locks phucduc.bui
` (2 subsequent siblings)
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:58 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for mutex locks.
In sst_algo_control_set() and sst_gain_put(), the mutex release point
moves from immediately before dev_err() to scope exit. However, the
affected path only emits a warning and immediately returns -EINVAL,
without any further processing, so the change does not affect behavior.
This is purely a code refactoring with no intended functional change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/atom/sst-atom-controls.c | 85 +++++++++++-------------
1 file changed, 37 insertions(+), 48 deletions(-)
diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c
index 3629ceaaac17..54defde24397 100644
--- a/sound/soc/intel/atom/sst-atom-controls.c
+++ b/sound/soc/intel/atom/sst-atom-controls.c
@@ -75,10 +75,9 @@ static int sst_fill_and_send_cmd(struct sst_data *drv,
{
int ret;
- mutex_lock(&drv->lock);
+ guard(mutex)(&drv->lock);
ret = sst_fill_and_send_cmd_unlocked(drv, ipc_msg, block,
task_id, pipe_id, cmd_data, len);
- mutex_unlock(&drv->lock);
return ret;
}
@@ -167,15 +166,15 @@ static int sst_slot_get(struct snd_kcontrol *kcontrol,
unsigned int val, mux;
u8 *map = is_tx ? sst_ssp_rx_map : sst_ssp_tx_map;
- mutex_lock(&drv->lock);
- val = 1 << ctl_no;
- /* search which slot/channel has this bit set - there should be only one */
- for (mux = e->max; mux > 0; mux--)
- if (map[mux - 1] & val)
- break;
+ scoped_guard(mutex, &drv->lock) {
+ val = 1 << ctl_no;
+ /* search which slot/channel has this bit set - there should be only one */
+ for (mux = e->max; mux > 0; mux--)
+ if (map[mux - 1] & val)
+ break;
- ucontrol->value.enumerated.item[0] = mux;
- mutex_unlock(&drv->lock);
+ ucontrol->value.enumerated.item[0] = mux;
+ }
dev_dbg(c->dev, "%s - %s map = %#x\n",
is_tx ? "tx channel" : "rx slot",
@@ -235,7 +234,7 @@ static int sst_slot_put(struct snd_kcontrol *kcontrol,
if (mux > e->max - 1)
return -EINVAL;
- mutex_lock(&drv->lock);
+ guard(mutex)(&drv->lock);
/* first clear all registers of this bit */
for (i = 0; i < e->max; i++)
map[i] &= ~val;
@@ -244,7 +243,6 @@ static int sst_slot_put(struct snd_kcontrol *kcontrol,
/* kctl set to 'none' and we reset the bits so send IPC */
ret = sst_check_and_send_slot_map(drv, kcontrol);
- mutex_unlock(&drv->lock);
return ret;
}
@@ -258,7 +256,6 @@ static int sst_slot_put(struct snd_kcontrol *kcontrol,
ret = sst_check_and_send_slot_map(drv, kcontrol);
- mutex_unlock(&drv->lock);
return ret;
}
@@ -354,13 +351,12 @@ static int sst_algo_control_set(struct snd_kcontrol *kcontrol,
struct sst_algo_control *bc = (void *)kcontrol->private_value;
dev_dbg(cmpnt->dev, "control_name=%s\n", kcontrol->id.name);
- mutex_lock(&drv->lock);
+ guard(mutex)(&drv->lock);
switch (bc->type) {
case SST_ALGO_PARAMS:
memcpy(bc->params, ucontrol->value.bytes.data, bc->max);
break;
default:
- mutex_unlock(&drv->lock);
dev_err(cmpnt->dev, "Invalid Input- algo type:%d\n",
bc->type);
return -EINVAL;
@@ -368,7 +364,6 @@ static int sst_algo_control_set(struct snd_kcontrol *kcontrol,
/*if pipe is enabled, need to send the algo params from here*/
if (bc->w && bc->w->power)
ret = sst_send_algo_cmd(drv, bc);
- mutex_unlock(&drv->lock);
return ret;
}
@@ -475,7 +470,7 @@ static int sst_gain_put(struct snd_kcontrol *kcontrol,
struct sst_gain_mixer_control *mc = (void *)kcontrol->private_value;
struct sst_gain_value *gv = mc->gain_val;
- mutex_lock(&drv->lock);
+ guard(mutex)(&drv->lock);
switch (mc->type) {
case SST_GAIN_TLV:
@@ -497,7 +492,6 @@ static int sst_gain_put(struct snd_kcontrol *kcontrol,
break;
default:
- mutex_unlock(&drv->lock);
dev_err(cmpnt->dev, "Invalid Input- gain type:%d\n",
mc->type);
return -EINVAL;
@@ -506,7 +500,6 @@ static int sst_gain_put(struct snd_kcontrol *kcontrol,
if (mc->w && mc->w->power)
ret = sst_send_gain_cmd(drv, gv, mc->task_id,
mc->pipe_id | mc->instance_id, mc->module_id, 0);
- mutex_unlock(&drv->lock);
return ret;
}
@@ -521,10 +514,9 @@ static int sst_send_pipe_module_params(struct snd_soc_dapm_widget *w,
struct sst_data *drv = snd_soc_component_get_drvdata(c);
struct sst_ids *ids = w->priv;
- mutex_lock(&drv->lock);
+ guard(mutex)(&drv->lock);
sst_find_and_send_pipe_algo(drv, w->name, ids);
sst_set_pipe_gain(ids, drv, 0);
- mutex_unlock(&drv->lock);
return 0;
}
@@ -761,27 +753,27 @@ int sst_handle_vb_timer(struct snd_soc_dai *dai, bool enable)
return ret;
}
- mutex_lock(&drv->lock);
- if (enable)
- timer_usage++;
- else
- timer_usage--;
-
- /*
- * Send the command only if this call is the first enable or last
- * disable
- */
- if ((enable && (timer_usage == 1)) ||
- (!enable && (timer_usage == 0))) {
- ret = sst_fill_and_send_cmd_unlocked(drv, SST_IPC_IA_CMD,
- SST_FLAG_BLOCKED, SST_TASK_SBA, 0, &cmd,
- sizeof(cmd.header) + cmd.header.length);
- if (ret && enable) {
+ scoped_guard(mutex, &drv->lock) {
+ if (enable)
+ timer_usage++;
+ else
timer_usage--;
- enable = false;
+
+ /*
+ * Send the command only if this call is the first enable or last
+ * disable
+ */
+ if ((enable && (timer_usage == 1)) ||
+ (!enable && (timer_usage == 0))) {
+ ret = sst_fill_and_send_cmd_unlocked(drv, SST_IPC_IA_CMD,
+ SST_FLAG_BLOCKED, SST_TASK_SBA, 0, &cmd,
+ sizeof(cmd.header) + cmd.header.length);
+ if (ret && enable) {
+ timer_usage--;
+ enable = false;
+ }
}
}
- mutex_unlock(&drv->lock);
if (!enable)
sst->ops->power(sst->dev, false);
@@ -984,9 +976,8 @@ static int sst_set_be_modules(struct snd_soc_dapm_widget *w,
dev_dbg(c->dev, "Enter: widget=%s\n", w->name);
if (SND_SOC_DAPM_EVENT_ON(event)) {
- mutex_lock(&drv->lock);
- ret = sst_send_slot_map(drv);
- mutex_unlock(&drv->lock);
+ scoped_guard(mutex, &drv->lock)
+ ret = sst_send_slot_map(drv);
if (ret)
return ret;
ret = sst_send_pipe_module_params(w, k);
@@ -1344,9 +1335,8 @@ int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute)
dev_dbg(dai->dev, "send gains for widget=%s\n",
p->sink->name);
- mutex_lock(&drv->lock);
- sst_set_pipe_gain(ids, drv, mute);
- mutex_unlock(&drv->lock);
+ scoped_guard(mutex, &drv->lock)
+ sst_set_pipe_gain(ids, drv, mute);
}
}
} else {
@@ -1360,9 +1350,8 @@ int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute)
dev_dbg(dai->dev, "send gain for widget=%s\n",
p->source->name);
- mutex_lock(&drv->lock);
- sst_set_pipe_gain(ids, drv, mute);
- mutex_unlock(&drv->lock);
+ scoped_guard(mutex, &drv->lock)
+ sst_set_pipe_gain(ids, drv, mute);
}
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 19/20] ASoC: Intel: atom: sst-mfld-platform-pcm: Use guard() for mutex & spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (17 preceding siblings ...)
2026-06-11 11:58 ` [PATCH 18/20] ASoC: Intel: atom: sst-atom-controls: Use guard() for mutex locks phucduc.bui
@ 2026-06-11 11:59 ` phucduc.bui
2026-06-11 11:59 ` [PATCH 20/20] ASoC: Intel: atom: sst_ipc: Use guard() for " phucduc.bui
2026-06-11 19:04 ` [PATCH 00/20] ASoC: Intel: Use guard() for mutex & " Cezary Rojewski
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:59 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Convert mutex and spinlock protected sections to guard()/scoped_guard()
helpers and simplify the cleanup paths. Also use __free(kfree) for the
temporary stream pointer in sst_media_open().
This is purely a code refactoring with no intended functional change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/atom/sst-mfld-platform-pcm.c | 51 ++++++++------------
1 file changed, 19 insertions(+), 32 deletions(-)
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
index f074af2499c8..f9df5694f049 100644
--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
@@ -32,16 +32,15 @@ int sst_register_dsp(struct sst_device *dev)
return -EINVAL;
if (!try_module_get(dev->dev->driver->owner))
return -ENODEV;
- mutex_lock(&sst_lock);
+ guard(mutex)(&sst_lock);
if (sst) {
dev_err(dev->dev, "we already have a device %s\n", sst->name);
module_put(dev->dev->driver->owner);
- mutex_unlock(&sst_lock);
return -EEXIST;
}
dev_dbg(dev->dev, "registering device %s\n", dev->name);
sst = dev;
- mutex_unlock(&sst_lock);
+
return 0;
}
EXPORT_SYMBOL_GPL(sst_register_dsp);
@@ -53,17 +52,15 @@ int sst_unregister_dsp(struct sst_device *dev)
if (dev != sst)
return -EINVAL;
- mutex_lock(&sst_lock);
+ guard(mutex)(&sst_lock);
- if (!sst) {
- mutex_unlock(&sst_lock);
+ if (!sst)
return -EIO;
- }
module_put(sst->dev->driver->owner);
dev_dbg(dev->dev, "unreg %s\n", sst->name);
sst = NULL;
- mutex_unlock(&sst_lock);
+
return 0;
}
EXPORT_SYMBOL_GPL(sst_unregister_dsp);
@@ -103,21 +100,15 @@ static int sst_media_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
void sst_set_stream_status(struct sst_runtime_stream *stream,
int state)
{
- unsigned long flags;
- spin_lock_irqsave(&stream->status_lock, flags);
+ guard(spinlock_irqsave)(&stream->status_lock);
stream->stream_status = state;
- spin_unlock_irqrestore(&stream->status_lock, flags);
}
static inline int sst_get_stream_status(struct sst_runtime_stream *stream)
{
- int state;
- unsigned long flags;
+ guard(spinlock_irqsave)(&stream->status_lock);
- spin_lock_irqsave(&stream->status_lock, flags);
- state = stream->stream_status;
- spin_unlock_irqrestore(&stream->status_lock, flags);
- return state;
+ return stream->stream_status;
}
static void sst_fill_alloc_params(struct snd_pcm_substream *substream,
@@ -304,7 +295,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,
{
int ret_val = 0;
struct snd_pcm_runtime *runtime = substream->runtime;
- struct sst_runtime_stream *stream;
+ struct sst_runtime_stream *stream __free(kfree) = NULL;
stream = kzalloc_obj(*stream);
if (!stream)
@@ -312,15 +303,14 @@ static int sst_media_open(struct snd_pcm_substream *substream,
spin_lock_init(&stream->status_lock);
/* get the sst ops */
- mutex_lock(&sst_lock);
- if (!sst ||
- !try_module_get(sst->dev->driver->owner)) {
- dev_err(dai->dev, "no device available to run\n");
- ret_val = -ENODEV;
- goto out_ops;
+ scoped_guard(mutex, &sst_lock) {
+ if (!sst ||
+ !try_module_get(sst->dev->driver->owner)) {
+ dev_err(dai->dev, "no device available to run\n");
+ return -ENODEV;
+ }
+ stream->ops = sst->ops;
}
- stream->ops = sst->ops;
- mutex_unlock(&sst_lock);
stream->stream_info.str_id = 0;
@@ -330,7 +320,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,
ret_val = power_up_sst(stream);
if (ret_val < 0)
- goto out_power_up;
+ return ret_val;
/*
* Make sure the period to be multiple of 1ms to align the
@@ -347,13 +337,10 @@ static int sst_media_open(struct snd_pcm_substream *substream,
snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_PERIODS, 2);
+ stream = NULL;
+
return snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
-out_ops:
- mutex_unlock(&sst_lock);
-out_power_up:
- kfree(stream);
- return ret_val;
}
static void sst_media_close(struct snd_pcm_substream *substream,
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* [PATCH 20/20] ASoC: Intel: atom: sst_ipc: Use guard() for spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (18 preceding siblings ...)
2026-06-11 11:59 ` [PATCH 19/20] ASoC: Intel: atom: sst-mfld-platform-pcm: Use guard() for mutex & spin locks phucduc.bui
@ 2026-06-11 11:59 ` phucduc.bui
2026-06-11 19:04 ` [PATCH 00/20] ASoC: Intel: Use guard() for mutex & " Cezary Rojewski
20 siblings, 0 replies; 25+ messages in thread
From: phucduc.bui @ 2026-06-11 11:59 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Cezary Rojewski
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Clean up the code using guard() for spin locks.
Merely code refactoring, and no behavior change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/intel/atom/sst/sst_ipc.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sound/soc/intel/atom/sst/sst_ipc.c b/sound/soc/intel/atom/sst/sst_ipc.c
index 0d5e71e8a5b5..580678c89b28 100644
--- a/sound/soc/intel/atom/sst/sst_ipc.c
+++ b/sound/soc/intel/atom/sst/sst_ipc.c
@@ -38,9 +38,8 @@ struct sst_block *sst_create_block(struct intel_sst_drv *ctx,
msg->on = true;
msg->msg_id = msg_id;
msg->drv_id = drv_id;
- spin_lock_bh(&ctx->block_lock);
- list_add_tail(&msg->node, &ctx->block_list);
- spin_unlock_bh(&ctx->block_lock);
+ scoped_guard(spinlock_bh, &ctx->block_lock)
+ list_add_tail(&msg->node, &ctx->block_list);
return msg;
}
@@ -180,9 +179,8 @@ void intel_sst_clear_intr_mrfld(struct intel_sst_drv *sst_drv_ctx)
union interrupt_reg_mrfld isr;
union interrupt_reg_mrfld imr;
union ipc_header_mrfld clear_ipc;
- unsigned long irq_flags;
- spin_lock_irqsave(&sst_drv_ctx->ipc_spin_lock, irq_flags);
+ guard(spinlock_irqsave)(&sst_drv_ctx->ipc_spin_lock);
imr.full = sst_shim_read64(sst_drv_ctx->shim, SST_IMRX);
isr.full = sst_shim_read64(sst_drv_ctx->shim, SST_ISRX);
@@ -200,7 +198,6 @@ void intel_sst_clear_intr_mrfld(struct intel_sst_drv *sst_drv_ctx)
/* un mask busy interrupt */
imr.part.busy_interrupt = 0;
sst_shim_write64(sst_drv_ctx->shim, SST_IMRX, imr.full);
- spin_unlock_irqrestore(&sst_drv_ctx->ipc_spin_lock, irq_flags);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 25+ messages in thread* Re: [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks
2026-06-11 11:58 [PATCH 00/20] ASoC: Intel: Use guard() for mutex & spin locks phucduc.bui
` (19 preceding siblings ...)
2026-06-11 11:59 ` [PATCH 20/20] ASoC: Intel: atom: sst_ipc: Use guard() for " phucduc.bui
@ 2026-06-11 19:04 ` Cezary Rojewski
20 siblings, 0 replies; 25+ messages in thread
From: Cezary Rojewski @ 2026-06-11 19:04 UTC (permalink / raw)
To: phucduc.bui
Cc: Jaroslav Kysela, Takashi Iwai, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, linux-sound, linux-kernel,
Mark Brown, Liam Girdwood
On 6/11/2026 1:58 PM, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Hi all,
>
> This series converts mutex and spinlock handling in Intel ASoC drivers
> to use guard()/scoped_guard() helpers.
>
> Most patches are straightforward conversions. A few patches include
> small cleanup changes as part of the conversion process; these are
> documented in the individual commit messages. Overall, the series is
> intended to simplify the code and cleanup paths, with no behavioral
> changes to the affected functions.
>
> The series has been compile-tested only.
>
> Best regards,
> Phuc
>
> bui duc phuc (20):
> ASoC: Intel: catpt: ipc: Use guard() for mutex & spin locks
> ASoC: Intel: catpt: dsp: Use guard() for mutex locks
> ASoC: Intel: avs: utils: Use guard() for mutex locks
> ASoC: Intel: avs: probes: Use guard() for spin locks
> ASoC: Intel: avs: pcm: Use guard() for mutex & spin locks
> ASoC: Intel: avs: path: Use guard() for mutex & spin locks
> ASoC: Intel: avs: loader: Use guard() for mutex locks
> ASoC: Intel: avs: ipc: Use guard() for mutex & spin locks
> ASoC: Intel: avs: icl: Use guard() for spin locks
> ASoC: Intel: avs: debugfs: Use guard() for spin locks
> ASoC: Intel: avs: debug: Use guard() for spin locks
> ASoC: Intel: avs: core: Use guard() for mutex & spin locks
> ASoC: Intel: avs: control: Use guard() for spin locks
> ASoC: Intel: avs: apl: Use guard() for spin locks
> ASoC: Intel: atom: sst_stream: Use guard() for mutex locks
> ASoC: Intel: atom: sst_pvt: Use guard() for mutex & spin locks
> ASoC: Intel: atom: sst: Use guard() for spin locks
> ASoC: Intel: atom: sst-atom-controls: Use guard() for mutex locks
> ASoC: Intel: atom: sst-mfld-platform-pcm: Use guard() for mutex & spin
> locks
> ASoC: Intel: atom: sst_ipc: Use guard() for spin locks
Hi Phuc,
Recent changes took care of catpt-driver [1], so the first two patches
can be dropped. While I wanted to follow up with the avs-driver, I see
no reason why I shouldn't let you do that instead.
Now on to the review - there is no need to be as granular as you're
here. Two drivers are being updated here: the avs-driver and the
atom-driver (assuming the catpt-driver patches are already gone).
Sending a patch per file creates unnecessary traffic, so let's limit the
set to two changes.
Please use the following scopes for those:
ASoC: Intel: avs:
ASoC: Intel: atom:
Last but not least, your name and surname are not capitalized. That's
clearly not the case here, in the cover letter. Please adjust.
[1]:
https://lore.kernel.org/all/20260603085827.1964796-2-cezary.rojewski@intel.com/
Kind regards,
Czarek
^ permalink raw reply [flat|nested] 25+ messages in thread