Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 275307
b: refs/heads/master
c: 9e226b4
h: refs/heads/master
i:
  275305: 757eea5
  275303: fec817c
v: v3
  • Loading branch information
Takashi Iwai committed Nov 10, 2011
1 parent 05865c9 commit add1651
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aeb4b88ec0a948efce8e3a23a8f964d3560a7308
refs/heads/master: 9e226b4b7e77215ca70461edc33800f6c1ba63d3
18 changes: 14 additions & 4 deletions trunk/sound/core/vmaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct link_slave {
struct link_ctl_info info;
int vals[2]; /* current values */
unsigned int flags;
struct snd_kcontrol *kctl; /* original kcontrol pointer */
struct snd_kcontrol slave; /* the copy of original control entry */
};

Expand Down Expand Up @@ -252,6 +253,7 @@ int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
slave->count * sizeof(*slave->vd), GFP_KERNEL);
if (!srec)
return -ENOMEM;
srec->kctl = slave;
srec->slave = *slave;
memcpy(srec->slave.vd, slave->vd, slave->count * sizeof(*slave->vd));
srec->master = master_link;
Expand Down Expand Up @@ -333,10 +335,18 @@ static int master_put(struct snd_kcontrol *kcontrol,
static void master_free(struct snd_kcontrol *kcontrol)
{
struct link_master *master = snd_kcontrol_chip(kcontrol);
struct link_slave *slave;

list_for_each_entry(slave, &master->slaves, list)
slave->master = NULL;
struct link_slave *slave, *n;

/* free all slave links and retore the original slave kctls */
list_for_each_entry_safe(slave, n, &master->slaves, list) {
struct snd_kcontrol *sctl = slave->kctl;
struct list_head olist = sctl->list;
memcpy(sctl, &slave->slave, sizeof(*sctl));
memcpy(sctl->vd, slave->slave.vd,
sctl->count * sizeof(*sctl->vd));
sctl->list = olist; /* keep the current linked-list */
kfree(slave);
}
kfree(master);
}

Expand Down

0 comments on commit add1651

Please sign in to comment.