]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
ASoC: Add w->kcontrols, and populate it
authorStephen Warren <swarren@nvidia.com>
Thu, 28 Apr 2011 23:37:59 +0000 (17:37 -0600)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 3 May 2011 18:28:57 +0000 (19:28 +0100)
Future changes will need reference to the kcontrol created for a given
kcontrol_new. Store the created kcontrol values now.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
include/sound/soc-dapm.h
sound/soc/soc-dapm.c

index 76714be19e9da77d797ee978495e250997a61371..b25bf0ffc9472da4ca347fa3bf39963adf84391d 100644 (file)
@@ -474,6 +474,7 @@ struct snd_soc_dapm_widget {
        /* kcontrols that relate to this widget */
        int num_kcontrols;
        const struct snd_kcontrol_new *kcontrol_news;
+       struct snd_kcontrol **kcontrols;
 
        /* widget input and outputs */
        struct list_head sources;
index 35cc1ed00a446e8292e136d199a08918a26ef0d2..85b2c94535f42240ec8bb3c20cf5c1ea5e9ca180 100644 (file)
@@ -400,6 +400,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
                                path->long_name = NULL;
                                return ret;
                        }
+                       w->kcontrols[i] = path->kcontrol;
                }
        }
        return ret;
@@ -442,6 +443,8 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
        if (ret < 0)
                goto err;
 
+       w->kcontrols[0] = kcontrol;
+
        list_for_each_entry(path, &w->sources, list_sink)
                path->kcontrol = kcontrol;
 
@@ -1480,6 +1483,7 @@ static void dapm_free_widgets(struct snd_soc_dapm_context *dapm)
                        kfree(p->long_name);
                        kfree(p);
                }
+               kfree(w->kcontrols);
                kfree(w->name);
                kfree(w);
        }
@@ -1730,6 +1734,14 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
                if (w->new)
                        continue;
 
+               if (w->num_kcontrols) {
+                       w->kcontrols = kzalloc(w->num_kcontrols *
+                                               sizeof(struct snd_kcontrol *),
+                                               GFP_KERNEL);
+                       if (!w->kcontrols)
+                               return -ENOMEM;
+               }
+
                switch(w->id) {
                case snd_soc_dapm_switch:
                case snd_soc_dapm_mixer: