Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170056
b: refs/heads/master
c: 25d27ed
h: refs/heads/master
v: v3
  • Loading branch information
Clemens Ladisch authored and Takashi Iwai committed Nov 6, 2009
1 parent 5b3e05e commit 98b0924
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 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: 31cef7076ed9409a33f19ea372d6dc5fdefe27ae
refs/heads/master: 25d27eded1f4fc728e64f443adc339b5229be5d7
4 changes: 3 additions & 1 deletion trunk/include/sound/control.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ struct snd_kctl_event {

#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)

struct pid;

struct snd_ctl_file {
struct list_head list; /* list of all control files */
struct snd_card *card;
pid_t pid;
struct pid *pid;
int prefer_pcm_subdevice;
int prefer_rawmidi_subdevice;
wait_queue_head_t change_sleep;
Expand Down
5 changes: 3 additions & 2 deletions trunk/sound/core/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
ctl->card = card;
ctl->prefer_pcm_subdevice = -1;
ctl->prefer_rawmidi_subdevice = -1;
ctl->pid = current->pid;
ctl->pid = get_pid(task_pid(current));
file->private_data = ctl;
write_lock_irqsave(&card->ctl_files_rwlock, flags);
list_add_tail(&ctl->list, &card->ctl_files);
Expand Down Expand Up @@ -125,6 +125,7 @@ static int snd_ctl_release(struct inode *inode, struct file *file)
control->vd[idx].owner = NULL;
up_write(&card->controls_rwsem);
snd_ctl_empty_read_queue(ctl);
put_pid(ctl->pid);
kfree(ctl);
module_put(card->module);
snd_card_file_remove(card, file);
Expand Down Expand Up @@ -672,7 +673,7 @@ static int snd_ctl_elem_info(struct snd_ctl_file *ctl,
info->access |= SNDRV_CTL_ELEM_ACCESS_LOCK;
if (vd->owner == ctl)
info->access |= SNDRV_CTL_ELEM_ACCESS_OWNER;
info->owner = vd->owner->pid;
info->owner = pid_vnr(vd->owner->pid);
} else {
info->owner = -1;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/sound/core/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
card = pcm->card;
read_lock(&card->ctl_files_rwlock);
list_for_each_entry(kctl, &card->ctl_files, list) {
if (kctl->pid == current->pid) {
if (kctl->pid == task_pid(current)) {
prefer_subdevice = kctl->prefer_pcm_subdevice;
if (prefer_subdevice != -1)
break;
Expand Down
2 changes: 1 addition & 1 deletion trunk/sound/core/rawmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
subdevice = -1;
read_lock(&card->ctl_files_rwlock);
list_for_each_entry(kctl, &card->ctl_files, list) {
if (kctl->pid == current->pid) {
if (kctl->pid == task_pid(current)) {
subdevice = kctl->prefer_rawmidi_subdevice;
if (subdevice != -1)
break;
Expand Down

0 comments on commit 98b0924

Please sign in to comment.