aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-11-10 16:30:03 +0100
committerTakashi Iwai <tiwai@suse.de>2009-11-10 16:30:03 +0100
commit3f225c07c7d0559f65b41250edd01a577fdba426 (patch)
tree753a9b9a9063e23d44986d974aeb2bc1986d7df8
parentb7fe750fcceda4fa6bef399b0e2812562728ea82 (diff)
parent25d27eded1f4fc728e64f443adc339b5229be5d7 (diff)
Merge branch 'topic/ctl-pid-lock' into topic/core-change
-rw-r--r--include/sound/control.h5
-rw-r--r--sound/core/control.c7
-rw-r--r--sound/core/pcm.c2
-rw-r--r--sound/core/rawmidi.c2
4 files changed, 8 insertions, 8 deletions
diff --git a/include/sound/control.h b/include/sound/control.h
index ef96f07aa03..112374dc0c5 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -56,7 +56,6 @@ struct snd_kcontrol_new {
struct snd_kcontrol_volatile {
struct snd_ctl_file *owner; /* locked */
- pid_t owner_pid;
unsigned int access; /* access rights */
};
@@ -87,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;
diff --git a/sound/core/control.c b/sound/core/control.c
index a8b7fabe645..73dc10ac33f 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -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);
@@ -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);
@@ -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;
}
@@ -827,7 +828,6 @@ static int snd_ctl_elem_lock(struct snd_ctl_file *file,
result = -EBUSY;
else {
vd->owner = file;
- vd->owner_pid = current->pid;
result = 0;
}
}
@@ -858,7 +858,6 @@ static int snd_ctl_elem_unlock(struct snd_ctl_file *file,
result = -EPERM;
else {
vd->owner = NULL;
- vd->owner_pid = 0;
result = 0;
}
}
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index c69c60b2a48..8e2c7833614 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -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;
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 70d6f25ba52..4e26563431c 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -413,7 +413,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;