diff options
author | Dave Airlie <airlied@redhat.com> | 2011-12-20 09:43:53 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-12-20 09:43:53 -0500 |
commit | 1fbe6f625f69e48c4001051dc1431afc704acfaa (patch) | |
tree | 826b741201a2e09a627ed350c6ff36935f5cff79 /sound/core/vmaster.c | |
parent | 0cecdd818cd79d092e36e70dfe3a71f2878d6b96 (diff) | |
parent | 384703b8e6cd4c8ef08512e596024e028c91c339 (diff) |
Merge tag 'v3.2-rc6' of /home/airlied/devel/kernel/linux-2.6 into drm-core-next
Merge in the upstream tree to bring in the mainline fixes.
Conflicts:
drivers/gpu/drm/exynos/exynos_drm_fbdev.c
drivers/gpu/drm/nouveau/nouveau_sgdma.c
Diffstat (limited to 'sound/core/vmaster.c')
-rw-r--r-- | sound/core/vmaster.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index 5dbab38d04af..130cfe677d60 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c | |||
@@ -52,6 +52,7 @@ struct link_slave { | |||
52 | struct link_ctl_info info; | 52 | struct link_ctl_info info; |
53 | int vals[2]; /* current values */ | 53 | int vals[2]; /* current values */ |
54 | unsigned int flags; | 54 | unsigned int flags; |
55 | struct snd_kcontrol *kctl; /* original kcontrol pointer */ | ||
55 | struct snd_kcontrol slave; /* the copy of original control entry */ | 56 | struct snd_kcontrol slave; /* the copy of original control entry */ |
56 | }; | 57 | }; |
57 | 58 | ||
@@ -252,6 +253,7 @@ int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave, | |||
252 | slave->count * sizeof(*slave->vd), GFP_KERNEL); | 253 | slave->count * sizeof(*slave->vd), GFP_KERNEL); |
253 | if (!srec) | 254 | if (!srec) |
254 | return -ENOMEM; | 255 | return -ENOMEM; |
256 | srec->kctl = slave; | ||
255 | srec->slave = *slave; | 257 | srec->slave = *slave; |
256 | memcpy(srec->slave.vd, slave->vd, slave->count * sizeof(*slave->vd)); | 258 | memcpy(srec->slave.vd, slave->vd, slave->count * sizeof(*slave->vd)); |
257 | srec->master = master_link; | 259 | srec->master = master_link; |
@@ -333,10 +335,18 @@ static int master_put(struct snd_kcontrol *kcontrol, | |||
333 | static void master_free(struct snd_kcontrol *kcontrol) | 335 | static void master_free(struct snd_kcontrol *kcontrol) |
334 | { | 336 | { |
335 | struct link_master *master = snd_kcontrol_chip(kcontrol); | 337 | struct link_master *master = snd_kcontrol_chip(kcontrol); |
336 | struct link_slave *slave; | 338 | struct link_slave *slave, *n; |
337 | 339 | ||
338 | list_for_each_entry(slave, &master->slaves, list) | 340 | /* free all slave links and retore the original slave kctls */ |
339 | slave->master = NULL; | 341 | list_for_each_entry_safe(slave, n, &master->slaves, list) { |
342 | struct snd_kcontrol *sctl = slave->kctl; | ||
343 | struct list_head olist = sctl->list; | ||
344 | memcpy(sctl, &slave->slave, sizeof(*sctl)); | ||
345 | memcpy(sctl->vd, slave->slave.vd, | ||
346 | sctl->count * sizeof(*sctl->vd)); | ||
347 | sctl->list = olist; /* keep the current linked-list */ | ||
348 | kfree(slave); | ||
349 | } | ||
340 | kfree(master); | 350 | kfree(master); |
341 | } | 351 | } |
342 | 352 | ||