[PATCH v4 2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex

From: Troy Mitchell

Date: Fri May 22 2026 - 09:43:30 EST


Define a guard class wrapping snd_soc_card_mutex_lock() and
snd_soc_card_mutex_unlock() so that scope-based locking can be used
while still picking up the SND_SOC_CARD_CLASS_RUNTIME lockdep subclass.

Signed-off-by: Troy Mitchell <troy.mitchell@xxxxxxxxxxxxxxxxxx>
---
sound/soc/soc-pcm.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 9b12eedb77c3..25e494c4ed81 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -26,6 +26,9 @@
#include <sound/soc-link.h>
#include <sound/initval.h>

+
+DEFINE_GUARD(snd_soc_card_mutex, struct snd_soc_card *,
+ snd_soc_card_mutex_lock(_T), snd_soc_card_mutex_unlock(_T))
#define soc_pcm_ret(rtd, ret) _soc_pcm_ret(rtd, __func__, ret)
static inline int _soc_pcm_ret(struct snd_soc_pcm_runtime *rtd,
const char *func, int ret)

--
2.54.0