diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /sound/core/rawmidi.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'sound/core/rawmidi.c')
-rw-r--r-- | sound/core/rawmidi.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 70d6f25ba526..0f5a194695d9 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -242,8 +242,6 @@ static int assign_substream(struct snd_rawmidi *rmidi, int subdevice, | |||
242 | return -ENXIO; | 242 | return -ENXIO; |
243 | if (subdevice >= 0 && subdevice >= s->substream_count) | 243 | if (subdevice >= 0 && subdevice >= s->substream_count) |
244 | return -ENODEV; | 244 | return -ENODEV; |
245 | if (s->substream_opened >= s->substream_count) | ||
246 | return -EAGAIN; | ||
247 | 245 | ||
248 | list_for_each_entry(substream, &s->substreams, list) { | 246 | list_for_each_entry(substream, &s->substreams, list) { |
249 | if (substream->opened) { | 247 | if (substream->opened) { |
@@ -280,9 +278,10 @@ static int open_substream(struct snd_rawmidi *rmidi, | |||
280 | substream->active_sensing = 0; | 278 | substream->active_sensing = 0; |
281 | if (mode & SNDRV_RAWMIDI_LFLG_APPEND) | 279 | if (mode & SNDRV_RAWMIDI_LFLG_APPEND) |
282 | substream->append = 1; | 280 | substream->append = 1; |
281 | substream->pid = get_pid(task_pid(current)); | ||
282 | rmidi->streams[substream->stream].substream_opened++; | ||
283 | } | 283 | } |
284 | substream->use_count++; | 284 | substream->use_count++; |
285 | rmidi->streams[substream->stream].substream_opened++; | ||
286 | return 0; | 285 | return 0; |
287 | } | 286 | } |
288 | 287 | ||
@@ -413,7 +412,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
413 | subdevice = -1; | 412 | subdevice = -1; |
414 | read_lock(&card->ctl_files_rwlock); | 413 | read_lock(&card->ctl_files_rwlock); |
415 | list_for_each_entry(kctl, &card->ctl_files, list) { | 414 | list_for_each_entry(kctl, &card->ctl_files, list) { |
416 | if (kctl->pid == current->pid) { | 415 | if (kctl->pid == task_pid(current)) { |
417 | subdevice = kctl->prefer_rawmidi_subdevice; | 416 | subdevice = kctl->prefer_rawmidi_subdevice; |
418 | if (subdevice != -1) | 417 | if (subdevice != -1) |
419 | break; | 418 | break; |
@@ -466,7 +465,6 @@ static void close_substream(struct snd_rawmidi *rmidi, | |||
466 | struct snd_rawmidi_substream *substream, | 465 | struct snd_rawmidi_substream *substream, |
467 | int cleanup) | 466 | int cleanup) |
468 | { | 467 | { |
469 | rmidi->streams[substream->stream].substream_opened--; | ||
470 | if (--substream->use_count) | 468 | if (--substream->use_count) |
471 | return; | 469 | return; |
472 | 470 | ||
@@ -491,6 +489,9 @@ static void close_substream(struct snd_rawmidi *rmidi, | |||
491 | snd_rawmidi_runtime_free(substream); | 489 | snd_rawmidi_runtime_free(substream); |
492 | substream->opened = 0; | 490 | substream->opened = 0; |
493 | substream->append = 0; | 491 | substream->append = 0; |
492 | put_pid(substream->pid); | ||
493 | substream->pid = NULL; | ||
494 | rmidi->streams[substream->stream].substream_opened--; | ||
494 | } | 495 | } |
495 | 496 | ||
496 | static void rawmidi_release_priv(struct snd_rawmidi_file *rfile) | 497 | static void rawmidi_release_priv(struct snd_rawmidi_file *rfile) |
@@ -1256,7 +1257,7 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, | |||
1256 | break; | 1257 | break; |
1257 | count -= count1; | 1258 | count -= count1; |
1258 | } | 1259 | } |
1259 | if (file->f_flags & O_SYNC) { | 1260 | if (file->f_flags & O_DSYNC) { |
1260 | spin_lock_irq(&runtime->lock); | 1261 | spin_lock_irq(&runtime->lock); |
1261 | while (runtime->avail != runtime->buffer_size) { | 1262 | while (runtime->avail != runtime->buffer_size) { |
1262 | wait_queue_t wait; | 1263 | wait_queue_t wait; |
@@ -1338,6 +1339,9 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry, | |||
1338 | substream->number, | 1339 | substream->number, |
1339 | (unsigned long) substream->bytes); | 1340 | (unsigned long) substream->bytes); |
1340 | if (substream->opened) { | 1341 | if (substream->opened) { |
1342 | snd_iprintf(buffer, | ||
1343 | " Owner PID : %d\n", | ||
1344 | pid_vnr(substream->pid)); | ||
1341 | runtime = substream->runtime; | 1345 | runtime = substream->runtime; |
1342 | snd_iprintf(buffer, | 1346 | snd_iprintf(buffer, |
1343 | " Mode : %s\n" | 1347 | " Mode : %s\n" |
@@ -1359,6 +1363,9 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry, | |||
1359 | substream->number, | 1363 | substream->number, |
1360 | (unsigned long) substream->bytes); | 1364 | (unsigned long) substream->bytes); |
1361 | if (substream->opened) { | 1365 | if (substream->opened) { |
1366 | snd_iprintf(buffer, | ||
1367 | " Owner PID : %d\n", | ||
1368 | pid_vnr(substream->pid)); | ||
1362 | runtime = substream->runtime; | 1369 | runtime = substream->runtime; |
1363 | snd_iprintf(buffer, | 1370 | snd_iprintf(buffer, |
1364 | " Buffer size : %lu\n" | 1371 | " Buffer size : %lu\n" |