summaryrefslogtreecommitdiff
path: root/include/sound/soc-dapm.h
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2023-04-06 03:15:48 +0300
committerMark Brown <broonie@kernel.org>2023-04-17 14:57:24 +0300
commit4a778bdc7afbc422bd513c4f1cd7a9faf4bebaab (patch)
tree57ccca7aceba170f198c7623a2eed7a87059ea46 /include/sound/soc-dapm.h
parentfc0b096c92918c2ba4d76411ea763fdeb2ef6b0d (diff)
downloadlinux-4a778bdc7afbc422bd513c4f1cd7a9faf4bebaab.tar.xz
ASoC: expand snd_soc_dapm_mutex_lock/unlock()
soc.h has snd_soc_dapm_mutex_lock/unlock() definition and many drivers are using it, but soc-dapm.c is not. 1st reason is snd_soc_dapm_mutex_lock/unlock() requests snd_soc_dapm_context pointer as parameter (A), but sometimes soc-dapm.c needs to use snd_soc_card (B). (A) static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm) { mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); } ^^^^^^^^^^ (B) mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); ^^^^ 2nd reason is it want to use SND_SOC_DAPM_CLASS_INIT for mutex_lock_nested(), but helper is using _RUNTIME (A). The conclusion is we want to use "dapm vs card" and "_RUNTIME vs _INIT" for dapm lock/unlock. To enable this selfish request, this patch uses _Generic macro. We can use snd_soc_dapm_mutex_lock/unlock() for both dapm and card case. snd_soc_dapm_mutex_lock(dapm); snd_soc_dapm_mutex_unlock(dapm); snd_soc_dapm_mutex_lock(card); snd_soc_dapm_mutex_unlock(card); Current soc-dapm.c is using both mutex_lock() and mutex_lock_nested(). This patch handles mutex_lock() as mutex_lock_nested(..., 0), in other words, handles below as same. mutex_lock(&card->dapm_mutex); mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); Because people might misunderstand that _init() is mutex initialization, this patch renames _INIT to _ROOT and adds new snd_soc_dapm_mutex_lock_root() for it. This patch also moves snd_soc_dapm_subclass definition from soc-dapm.h to soc.h to keep related code together. Because very complex soc.h vs soc-dapm.h relationship, it is difficult/impossible to define these helper into soc-dapm.h. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87cz4hx3v0.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/sound/soc-dapm.h')
-rw-r--r--include/sound/soc-dapm.h5
1 files changed, 0 insertions, 5 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 64915ebd641e..87f8e1793af1 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -527,11 +527,6 @@ enum snd_soc_dapm_type {
SND_SOC_DAPM_TYPE_COUNT
};
-enum snd_soc_dapm_subclass {
- SND_SOC_DAPM_CLASS_INIT = 0,
- SND_SOC_DAPM_CLASS_RUNTIME = 1,
-};
-
/*
* DAPM audio route definition.
*