ASoC: Remove snd_soc_codec dapm field
authorLars-Peter Clausen <lars@metafoo.de>
Mon, 6 Jul 2015 13:38:11 +0000 (15:38 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 7 Jul 2015 13:54:32 +0000 (14:54 +0100)
There are no more direct users of the snd_soc_codec DAPM field left. So we
can finally remove it and switch over to directly using the component DAPM
context and remove the dapm_ptr indirection.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/soc-core.c

index 93df8bf9d54a9e1b9502836faec752b4c6aa20b0..3ccd82a16d5492b008a4356a221c3586cb83ac6a 100644 (file)
@@ -792,7 +792,6 @@ struct snd_soc_component {
 
        /* Don't use these, use snd_soc_component_get_dapm() */
        struct snd_soc_dapm_context dapm;
-       struct snd_soc_dapm_context *dapm_ptr;
 
        const struct snd_kcontrol_new *controls;
        unsigned int num_controls;
@@ -832,9 +831,6 @@ struct snd_soc_codec {
        /* component */
        struct snd_soc_component component;
 
-       /* Don't access this directly, use snd_soc_codec_get_dapm() */
-       struct snd_soc_dapm_context dapm;
-
 #ifdef CONFIG_DEBUG_FS
        struct dentry *debugfs_reg;
 #endif
@@ -1277,7 +1273,7 @@ static inline struct snd_soc_component *snd_soc_dapm_to_component(
 static inline struct snd_soc_codec *snd_soc_dapm_to_codec(
        struct snd_soc_dapm_context *dapm)
 {
-       return container_of(dapm, struct snd_soc_codec, dapm);
+       return snd_soc_component_to_codec(snd_soc_dapm_to_component(dapm));
 }
 
 /**
@@ -1302,7 +1298,7 @@ static inline struct snd_soc_platform *snd_soc_dapm_to_platform(
 static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
        struct snd_soc_component *component)
 {
-       return component->dapm_ptr;
+       return &component->dapm;
 }
 
 /**
@@ -1314,7 +1310,7 @@ static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
 static inline struct snd_soc_dapm_context *snd_soc_codec_get_dapm(
        struct snd_soc_codec *codec)
 {
-       return &codec->dapm;
+       return snd_soc_component_get_dapm(&codec->component);
 }
 
 /**
index 3a4a5c0e3f9737c795f74367b04c9825462651f8..3747111f875981979b43de959f8faf1db1c8e439 100644 (file)
@@ -654,10 +654,12 @@ int snd_soc_suspend(struct device *dev)
 
        /* suspend all CODECs */
        list_for_each_entry(codec, &card->codec_dev_list, card_list) {
+               struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+
                /* If there are paths active then the CODEC will be held with
                 * bias _ON and should not be suspended. */
                if (!codec->suspended) {
-                       switch (codec->dapm.bias_level) {
+                       switch (snd_soc_dapm_get_bias_level(dapm)) {
                        case SND_SOC_BIAS_STANDBY:
                                /*
                                 * If the CODEC is capable of idle
@@ -665,7 +667,7 @@ int snd_soc_suspend(struct device *dev)
                                 * means it's doing something,
                                 * otherwise fall through.
                                 */
-                               if (codec->dapm.idle_bias_off) {
+                               if (dapm->idle_bias_off) {
                                        dev_dbg(codec->dev,
                                                "ASoC: idle_bias_off CODEC on over suspend\n");
                                        break;
@@ -2651,10 +2653,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
        component->probe = component->driver->probe;
        component->remove = component->driver->remove;
 
-       if (!component->dapm_ptr)
-               component->dapm_ptr = &component->dapm;
-
-       dapm = component->dapm_ptr;
+       dapm = &component->dapm;
        dapm->dev = dev;
        dapm->component = component;
        dapm->bias_level = SND_SOC_BIAS_OFF;
@@ -3036,6 +3035,7 @@ int snd_soc_register_codec(struct device *dev,
                           struct snd_soc_dai_driver *dai_drv,
                           int num_dai)
 {
+       struct snd_soc_dapm_context *dapm;
        struct snd_soc_codec *codec;
        struct snd_soc_dai *dai;
        int ret, i;
@@ -3046,7 +3046,6 @@ int snd_soc_register_codec(struct device *dev,
        if (codec == NULL)
                return -ENOMEM;
 
-       codec->component.dapm_ptr = &codec->dapm;
        codec->component.codec = codec;
 
        ret = snd_soc_component_initialize(&codec->component,
@@ -3076,12 +3075,14 @@ int snd_soc_register_codec(struct device *dev,
        if (codec_drv->read)
                codec->component.read = snd_soc_codec_drv_read;
        codec->component.ignore_pmdown_time = codec_drv->ignore_pmdown_time;
-       codec->dapm.idle_bias_off = codec_drv->idle_bias_off;
-       codec->dapm.suspend_bias_off = codec_drv->suspend_bias_off;
+
+       dapm = snd_soc_codec_get_dapm(codec);
+       dapm->idle_bias_off = codec_drv->idle_bias_off;
+       dapm->suspend_bias_off = codec_drv->suspend_bias_off;
        if (codec_drv->seq_notifier)
-               codec->dapm.seq_notifier = codec_drv->seq_notifier;
+               dapm->seq_notifier = codec_drv->seq_notifier;
        if (codec_drv->set_bias_level)
-               codec->dapm.set_bias_level = snd_soc_codec_set_bias_level;
+               dapm->set_bias_level = snd_soc_codec_set_bias_level;
        codec->dev = dev;
        codec->driver = codec_drv;
        codec->component.val_bytes = codec_drv->reg_word_size;