diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-10-11 07:45:22 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-10-11 07:45:22 -0400 |
commit | 4e83998f5af010a928495988c586ea2926624db9 (patch) | |
tree | e72d346172a30bbee165d7f585784724906da416 /sound/core | |
parent | dd1d3a49db4ae5c6afffadaff526b96c7993c7dd (diff) | |
parent | d4cfa4d12f46e2520f4c1d1a92e891ce068b7464 (diff) |
Merge branch 'fix/misc' into topic/misc
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/control.c | 5 | ||||
-rw-r--r-- | sound/core/pcm.c | 33 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 2 |
3 files changed, 31 insertions, 9 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index 070aab490191..45a818002d99 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | /* max number of user-defined controls */ | 32 | /* max number of user-defined controls */ |
33 | #define MAX_USER_CONTROLS 32 | 33 | #define MAX_USER_CONTROLS 32 |
34 | #define MAX_CONTROL_COUNT 1028 | ||
34 | 35 | ||
35 | struct snd_kctl_ioctl { | 36 | struct snd_kctl_ioctl { |
36 | struct list_head list; /* list of all ioctls */ | 37 | struct list_head list; /* list of all ioctls */ |
@@ -195,6 +196,10 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control, | |||
195 | 196 | ||
196 | if (snd_BUG_ON(!control || !control->count)) | 197 | if (snd_BUG_ON(!control || !control->count)) |
197 | return NULL; | 198 | return NULL; |
199 | |||
200 | if (control->count > MAX_CONTROL_COUNT) | ||
201 | return NULL; | ||
202 | |||
198 | kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL); | 203 | kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL); |
199 | if (kctl == NULL) { | 204 | if (kctl == NULL) { |
200 | snd_printk(KERN_ERR "Cannot allocate control instance\n"); | 205 | snd_printk(KERN_ERR "Cannot allocate control instance\n"); |
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 | ||
402 | static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry, | 407 | static 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 | ||
425 | static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry, | 435 | static 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 |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index eb4094270a4f..8bc7cb3db330 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1994,6 +1994,8 @@ void snd_pcm_release_substream(struct snd_pcm_substream *substream) | |||
1994 | substream->ops->close(substream); | 1994 | substream->ops->close(substream); |
1995 | substream->hw_opened = 0; | 1995 | substream->hw_opened = 0; |
1996 | } | 1996 | } |
1997 | if (pm_qos_request_active(&substream->latency_pm_qos_req)) | ||
1998 | pm_qos_remove_request(&substream->latency_pm_qos_req); | ||
1997 | if (substream->pcm_release) { | 1999 | if (substream->pcm_release) { |
1998 | substream->pcm_release(substream); | 2000 | substream->pcm_release(substream); |
1999 | substream->pcm_release = NULL; | 2001 | substream->pcm_release = NULL; |