]> err.no Git - linux-2.6/blobdiff - sound/pci/hda/hda_codec.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/lmb-2.6
[linux-2.6] / sound / pci / hda / hda_codec.c
index 26812dc2b7f22c56a9c8c506863696ddf8f91b52..37c413923db8a4762da4e7af66989af1e5e3d1a4 100644 (file)
@@ -1055,6 +1055,12 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
        const char **s;
        int err;
 
+       for (s = slaves; *s && !snd_hda_find_mixer_ctl(codec, *s); s++)
+               ;
+       if (!*s) {
+               snd_printdd("No slave found for %s\n", name);
+               return 0;
+       }
        kctl = snd_ctl_make_virtual_master(name, tlv);
        if (!kctl)
                return -ENOMEM;
@@ -1197,8 +1203,8 @@ int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol,
        struct hda_bind_ctls *c;
        int err;
 
-       c = (struct hda_bind_ctls *)kcontrol->private_value;
        mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
+       c = (struct hda_bind_ctls *)kcontrol->private_value;
        kcontrol->private_value = *c->values;
        err = c->ops->info(kcontrol, uinfo);
        kcontrol->private_value = (long)c;
@@ -1213,8 +1219,8 @@ int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol,
        struct hda_bind_ctls *c;
        int err;
 
-       c = (struct hda_bind_ctls *)kcontrol->private_value;
        mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
+       c = (struct hda_bind_ctls *)kcontrol->private_value;
        kcontrol->private_value = *c->values;
        err = c->ops->get(kcontrol, ucontrol);
        kcontrol->private_value = (long)c;
@@ -1230,8 +1236,8 @@ int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol,
        unsigned long *vals;
        int err = 0, change = 0;
 
-       c = (struct hda_bind_ctls *)kcontrol->private_value;
        mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
+       c = (struct hda_bind_ctls *)kcontrol->private_value;
        for (vals = c->values; *vals; vals++) {
                kcontrol->private_value = *vals;
                err = c->ops->put(kcontrol, ucontrol);
@@ -1251,8 +1257,8 @@ int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag,
        struct hda_bind_ctls *c;
        int err;
 
-       c = (struct hda_bind_ctls *)kcontrol->private_value;
        mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
+       c = (struct hda_bind_ctls *)kcontrol->private_value;
        kcontrol->private_value = *c->values;
        err = c->ops->tlv(kcontrol, op_flag, size, tlv);
        kcontrol->private_value = (long)c;