diff mbox

[02/17,v2] ASoC: dapm: Add helpers to lock/unlock DAPM mutex

Message ID 1392736948-26623-3-git-send-email-ckeepax@opensource.wolfsonmicro.com (mailing list archive)
State Accepted
Commit f6d5e586b416746664c01ab5d4b19ed5e2d1cbaa
Delegated to: Mark Brown
Headers show

Commit Message

Charles Keepax Feb. 18, 2014, 3:22 p.m. UTC
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>
---
 include/sound/soc.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Comments

Mark Brown Feb. 20, 2014, 10:23 a.m. UTC | #1
On Tue, Feb 18, 2014 at 03:22:13PM +0000, Charles Keepax wrote:
> 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.

Applied, thanks.
diff mbox

Patch

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 21038e0..dc46623 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1204,4 +1204,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