aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/pcm.c')
-rw-r--r--sound/core/pcm.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 88525a958291..6b4b1287b314 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -371,14 +371,17 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry,
371 struct snd_info_buffer *buffer) 371 struct snd_info_buffer *buffer)
372{ 372{
373 struct snd_pcm_substream *substream = entry->private_data; 373 struct snd_pcm_substream *substream = entry->private_data;
374 struct snd_pcm_runtime *runtime = substream->runtime; 374 struct snd_pcm_runtime *runtime;
375
376 mutex_lock(&substream->pcm->open_mutex);
377 runtime = substream->runtime;
375 if (!runtime) { 378 if (!runtime) {
376 snd_iprintf(buffer, "closed\n"); 379 snd_iprintf(buffer, "closed\n");
377 return; 380 goto unlock;
378 } 381 }
379 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { 382 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) {
380 snd_iprintf(buffer, "no setup\n"); 383 snd_iprintf(buffer, "no setup\n");
381 return; 384 goto unlock;
382 } 385 }
383 snd_iprintf(buffer, "access: %s\n", snd_pcm_access_name(runtime->access)); 386 snd_iprintf(buffer, "access: %s\n", snd_pcm_access_name(runtime->access));
384 snd_iprintf(buffer, "format: %s\n", snd_pcm_format_name(runtime->format)); 387 snd_iprintf(buffer, "format: %s\n", snd_pcm_format_name(runtime->format));
@@ -397,20 +400,25 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry,
397 snd_iprintf(buffer, "OSS period frames: %lu\n", (unsigned long)runtime->oss.period_frames); 400 snd_iprintf(buffer, "OSS period frames: %lu\n", (unsigned long)runtime->oss.period_frames);
398 } 401 }
399#endif 402#endif
403 unlock:
404 mutex_unlock(&substream->pcm->open_mutex);
400} 405}
401 406
402static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry, 407static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry,
403 struct snd_info_buffer *buffer) 408 struct snd_info_buffer *buffer)
404{ 409{
405 struct snd_pcm_substream *substream = entry->private_data; 410 struct snd_pcm_substream *substream = entry->private_data;
406 struct snd_pcm_runtime *runtime = substream->runtime; 411 struct snd_pcm_runtime *runtime;
412
413 mutex_lock(&substream->pcm->open_mutex);
414 runtime = substream->runtime;
407 if (!runtime) { 415 if (!runtime) {
408 snd_iprintf(buffer, "closed\n"); 416 snd_iprintf(buffer, "closed\n");
409 return; 417 goto unlock;
410 } 418 }
411 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { 419 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) {
412 snd_iprintf(buffer, "no setup\n"); 420 snd_iprintf(buffer, "no setup\n");
413 return; 421 goto unlock;
414 } 422 }
415 snd_iprintf(buffer, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(runtime->tstamp_mode)); 423 snd_iprintf(buffer, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(runtime->tstamp_mode));
416 snd_iprintf(buffer, "period_step: %u\n", runtime->period_step); 424 snd_iprintf(buffer, "period_step: %u\n", runtime->period_step);
@@ -420,24 +428,29 @@ static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry,
420 snd_iprintf(buffer, "silence_threshold: %lu\n", runtime->silence_threshold); 428 snd_iprintf(buffer, "silence_threshold: %lu\n", runtime->silence_threshold);
421 snd_iprintf(buffer, "silence_size: %lu\n", runtime->silence_size); 429 snd_iprintf(buffer, "silence_size: %lu\n", runtime->silence_size);
422 snd_iprintf(buffer, "boundary: %lu\n", runtime->boundary); 430 snd_iprintf(buffer, "boundary: %lu\n", runtime->boundary);
431 unlock:
432 mutex_unlock(&substream->pcm->open_mutex);
423} 433}
424 434
425static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry, 435static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry,
426 struct snd_info_buffer *buffer) 436 struct snd_info_buffer *buffer)
427{ 437{
428 struct snd_pcm_substream *substream = entry->private_data; 438 struct snd_pcm_substream *substream = entry->private_data;
429 struct snd_pcm_runtime *runtime = substream->runtime; 439 struct snd_pcm_runtime *runtime;
430 struct snd_pcm_status status; 440 struct snd_pcm_status status;
431 int err; 441 int err;
442
443 mutex_lock(&substream->pcm->open_mutex);
444 runtime = substream->runtime;
432 if (!runtime) { 445 if (!runtime) {
433 snd_iprintf(buffer, "closed\n"); 446 snd_iprintf(buffer, "closed\n");
434 return; 447 goto unlock;
435 } 448 }
436 memset(&status, 0, sizeof(status)); 449 memset(&status, 0, sizeof(status));
437 err = snd_pcm_status(substream, &status); 450 err = snd_pcm_status(substream, &status);
438 if (err < 0) { 451 if (err < 0) {
439 snd_iprintf(buffer, "error %d\n", err); 452 snd_iprintf(buffer, "error %d\n", err);
440 return; 453 goto unlock;
441 } 454 }
442 snd_iprintf(buffer, "state: %s\n", snd_pcm_state_name(status.state)); 455 snd_iprintf(buffer, "state: %s\n", snd_pcm_state_name(status.state));
443 snd_iprintf(buffer, "owner_pid : %d\n", pid_vnr(substream->pid)); 456 snd_iprintf(buffer, "owner_pid : %d\n", pid_vnr(substream->pid));
@@ -451,6 +464,8 @@ static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry,
451 snd_iprintf(buffer, "-----\n"); 464 snd_iprintf(buffer, "-----\n");
452 snd_iprintf(buffer, "hw_ptr : %ld\n", runtime->status->hw_ptr); 465 snd_iprintf(buffer, "hw_ptr : %ld\n", runtime->status->hw_ptr);
453 snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr); 466 snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr);
467 unlock:
468 mutex_unlock(&substream->pcm->open_mutex);
454} 469}
455 470
456#ifdef CONFIG_SND_PCM_XRUN_DEBUG 471#ifdef CONFIG_SND_PCM_XRUN_DEBUG