ASoC: dapm: Add helpers to lock/unlock DAPM mutex
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Tue, 18 Feb 2014 15:22:13 +0000 (15:22 +0000)
committerMark Brown <broonie@linaro.org>
Thu, 20 Feb 2014 10:22:23 +0000 (19:22 +0900)
Acquiring the DAPM mutex is necessary before using several DAPM
functions and dereference is quite ugly. This patch provides a helper
function to simplify this.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
include/sound/soc.h

index 9a001472b96a4bf8a11c8c129543060fdb75c869..1e12b66da2cc35313b103877ac59dac9388c688a 100644 (file)
@@ -1188,4 +1188,15 @@ extern struct dentry *snd_soc_debugfs_root;
 
 extern const struct dev_pm_ops snd_soc_pm_ops;
 
+/* Helper functions */
+static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
+{
+       mutex_lock(&dapm->card->dapm_mutex);
+}
+
+static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)
+{
+       mutex_unlock(&dapm->card->dapm_mutex);
+}
+
 #endif