diff mbox

[1/4] ASoC: Add helper function getting CODEC's DAPM context

Message ID 1430165606-3072-1-git-send-email-lars@metafoo.de (mailing list archive)
State Accepted
Commit 39ed68c8cd3aff417603a95d0594308598b9f469
Headers show

Commit Message

Lars-Peter Clausen April 27, 2015, 8:13 p.m. UTC
The DAPM context in the snd_soc_codec struct is redundant and scheduled to
be replaced by the DAPM context in the snd_soc_component struct. This patch
introduces a new helper function snd_soc_codec_get_dapm() which should be
used for getting the DAPM context for a CODEC rather then directly
accessing the dapm field. Once there are no more direct users of the dapm
field left it is possible to transparently switch all drivers to the
component DAPM context by updating snd_soc_codec_get_dapm() function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 include/sound/soc.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Mark Brown April 27, 2015, 8:34 p.m. UTC | #1
On Mon, Apr 27, 2015 at 10:13:22PM +0200, Lars-Peter Clausen wrote:
> The DAPM context in the snd_soc_codec struct is redundant and scheduled to
> be replaced by the DAPM context in the snd_soc_component struct. This patch
> introduces a new helper function snd_soc_codec_get_dapm() which should be

Applied all, thanks.
diff mbox

Patch

diff --git a/include/sound/soc.h b/include/sound/soc.h
index f6226914..d57dc7c 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -819,7 +819,7 @@  struct snd_soc_codec {
 	/* component */
 	struct snd_soc_component component;
 
-	/* dapm */
+	/* Don't access this directly, use snd_soc_codec_get_dapm() */
 	struct snd_soc_dapm_context dapm;
 
 #ifdef CONFIG_DEBUG_FS
@@ -1282,6 +1282,18 @@  static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
 }
 
 /**
+ * snd_soc_codec_get_dapm() - Returns the DAPM context for the CODEC
+ * @codec: The CODEC for which to get the DAPM context
+ *
+ * Note: Use this function instead of directly accessing the CODEC's dapm field
+ */
+static inline struct snd_soc_dapm_context *snd_soc_codec_get_dapm(
+	struct snd_soc_codec *codec)
+{
+	return &codec->dapm;
+}
+
+/**
  * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol
  * @kcontrol: The kcontrol
  *