diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2023-04-06 00:16:27 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-04-17 12:57:26 +0100 |
commit | 0f3b818486796ec8895fa4ccdf15edb759bff40a (patch) | |
tree | 7fc8dba52d49253349467e1f3e896bd6a23aeea6 /include/sound/soc-card.h | |
parent | 38e42f6d6c6702bbfc633fce9b579fb80cec2d59 (diff) | |
download | linux-rpi-0f3b818486796ec8895fa4ccdf15edb759bff40a.tar.gz linux-rpi-0f3b818486796ec8895fa4ccdf15edb759bff40a.tar.bz2 linux-rpi-0f3b818486796ec8895fa4ccdf15edb759bff40a.zip |
ASoC: add snd_soc_card_mutex_lock/unlock()
ASoC need to use card->mutex with _INIT or _RUNTIME,
but there is no helper function for it.
This patch adds its helper function and use it.
Because people might misunderstand that _init() is mutex initialization,
this patch renames _INIT to _ROOT and adds new
snd_soc_card_mutex_lock_root() for it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a5zlx3tw.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/sound/soc-card.h')
-rw-r--r-- | include/sound/soc-card.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h index 9d31a5c0db33..fc94dfb0021f 100644 --- a/include/sound/soc-card.h +++ b/include/sound/soc-card.h @@ -9,10 +9,25 @@ #define __SOC_CARD_H enum snd_soc_card_subclass { - SND_SOC_CARD_CLASS_INIT = 0, + SND_SOC_CARD_CLASS_ROOT = 0, SND_SOC_CARD_CLASS_RUNTIME = 1, }; +static inline void snd_soc_card_mutex_lock_root(struct snd_soc_card *card) +{ + mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_ROOT); +} + +static inline void snd_soc_card_mutex_lock(struct snd_soc_card *card) +{ + mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_RUNTIME); +} + +static inline void snd_soc_card_mutex_unlock(struct snd_soc_card *card) +{ + mutex_unlock(&card->mutex); +} + struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card, const char *name); int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type, |