diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-05 05:16:50 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-05 05:16:50 -0400 |
commit | 586a4ac509b041df55f26c2b26cd7cbdaf9b045d (patch) | |
tree | dd91fe472070836465da7901f22869b54b2999b8 /sound/core | |
parent | 374b1873571bf80dc0c1fcceaaad067980f3b9de (diff) | |
parent | 6b39374a27eb4be7e9d82145ae270ba02ea90dc8 (diff) |
/spare/repo/libata-dev branch 'master'
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/memalloc.c | 5 | ||||
-rw-r--r-- | sound/core/memory.c | 2 | ||||
-rw-r--r-- | sound/core/oss/pcm_oss.c | 11 | ||||
-rw-r--r-- | sound/core/pcm_compat.c | 49 | ||||
-rw-r--r-- | sound/core/pcm_lib.c | 20 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 14 | ||||
-rw-r--r-- | sound/core/sound_oss.c | 7 | ||||
-rw-r--r-- | sound/core/timer.c | 16 |
8 files changed, 78 insertions, 46 deletions
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 02132561c3f8..39a54a415528 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c | |||
@@ -512,7 +512,7 @@ static void free_all_reserved_pages(void) | |||
512 | * proc file interface | 512 | * proc file interface |
513 | */ | 513 | */ |
514 | #define SND_MEM_PROC_FILE "driver/snd-page-alloc" | 514 | #define SND_MEM_PROC_FILE "driver/snd-page-alloc" |
515 | struct proc_dir_entry *snd_mem_proc; | 515 | static struct proc_dir_entry *snd_mem_proc; |
516 | 516 | ||
517 | static int snd_mem_proc_read(char *page, char **start, off_t off, | 517 | static int snd_mem_proc_read(char *page, char **start, off_t off, |
518 | int count, int *eof, void *data) | 518 | int count, int *eof, void *data) |
@@ -655,8 +655,7 @@ static int __init snd_mem_init(void) | |||
655 | 655 | ||
656 | static void __exit snd_mem_exit(void) | 656 | static void __exit snd_mem_exit(void) |
657 | { | 657 | { |
658 | if (snd_mem_proc) | 658 | remove_proc_entry(SND_MEM_PROC_FILE, NULL); |
659 | remove_proc_entry(SND_MEM_PROC_FILE, NULL); | ||
660 | free_all_reserved_pages(); | 659 | free_all_reserved_pages(); |
661 | if (snd_allocated_pages > 0) | 660 | if (snd_allocated_pages > 0) |
662 | printk(KERN_ERR "snd-malloc: Memory leak? pages not freed = %li\n", snd_allocated_pages); | 661 | printk(KERN_ERR "snd-malloc: Memory leak? pages not freed = %li\n", snd_allocated_pages); |
diff --git a/sound/core/memory.c b/sound/core/memory.c index f6895577bf86..1622893d00a2 100644 --- a/sound/core/memory.c +++ b/sound/core/memory.c | |||
@@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(snd_alloc_vmalloc_lock); | |||
56 | #define VMALLOC_MAGIC 0x87654320 | 56 | #define VMALLOC_MAGIC 0x87654320 |
57 | static snd_info_entry_t *snd_memory_info_entry; | 57 | static snd_info_entry_t *snd_memory_info_entry; |
58 | 58 | ||
59 | void snd_memory_init(void) | 59 | void __init snd_memory_init(void) |
60 | { | 60 | { |
61 | snd_alloc_kmalloc = 0; | 61 | snd_alloc_kmalloc = 0; |
62 | snd_alloc_vmalloc = 0; | 62 | snd_alloc_vmalloc = 0; |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index de7444c586f9..a13bd7bb4c9f 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -1705,13 +1705,12 @@ static int snd_pcm_oss_release_file(snd_pcm_oss_file_t *pcm_oss_file) | |||
1705 | if (snd_pcm_running(substream)) | 1705 | if (snd_pcm_running(substream)) |
1706 | snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); | 1706 | snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); |
1707 | snd_pcm_stream_unlock_irq(substream); | 1707 | snd_pcm_stream_unlock_irq(substream); |
1708 | if (substream->open_flag) { | 1708 | if (substream->ffile != NULL) { |
1709 | if (substream->ops->hw_free != NULL) | 1709 | if (substream->ops->hw_free != NULL) |
1710 | substream->ops->hw_free(substream); | 1710 | substream->ops->hw_free(substream); |
1711 | substream->ops->close(substream); | 1711 | substream->ops->close(substream); |
1712 | substream->open_flag = 0; | 1712 | substream->ffile = NULL; |
1713 | } | 1713 | } |
1714 | substream->ffile = NULL; | ||
1715 | snd_pcm_oss_release_substream(substream); | 1714 | snd_pcm_oss_release_substream(substream); |
1716 | snd_pcm_release_substream(substream); | 1715 | snd_pcm_release_substream(substream); |
1717 | } | 1716 | } |
@@ -1778,14 +1777,13 @@ static int snd_pcm_oss_open_file(struct file *file, | |||
1778 | snd_pcm_oss_release_file(pcm_oss_file); | 1777 | snd_pcm_oss_release_file(pcm_oss_file); |
1779 | return err; | 1778 | return err; |
1780 | } | 1779 | } |
1781 | psubstream->open_flag = 1; | 1780 | psubstream->ffile = file; |
1782 | err = snd_pcm_hw_constraints_complete(psubstream); | 1781 | err = snd_pcm_hw_constraints_complete(psubstream); |
1783 | if (err < 0) { | 1782 | if (err < 0) { |
1784 | snd_printd("snd_pcm_hw_constraint_complete failed\n"); | 1783 | snd_printd("snd_pcm_hw_constraint_complete failed\n"); |
1785 | snd_pcm_oss_release_file(pcm_oss_file); | 1784 | snd_pcm_oss_release_file(pcm_oss_file); |
1786 | return err; | 1785 | return err; |
1787 | } | 1786 | } |
1788 | psubstream->ffile = file; | ||
1789 | snd_pcm_oss_init_substream(psubstream, psetup, minor); | 1787 | snd_pcm_oss_init_substream(psubstream, psetup, minor); |
1790 | } | 1788 | } |
1791 | if (csubstream != NULL) { | 1789 | if (csubstream != NULL) { |
@@ -1800,14 +1798,13 @@ static int snd_pcm_oss_open_file(struct file *file, | |||
1800 | snd_pcm_oss_release_file(pcm_oss_file); | 1798 | snd_pcm_oss_release_file(pcm_oss_file); |
1801 | return err; | 1799 | return err; |
1802 | } | 1800 | } |
1803 | csubstream->open_flag = 1; | 1801 | csubstream->ffile = file; |
1804 | err = snd_pcm_hw_constraints_complete(csubstream); | 1802 | err = snd_pcm_hw_constraints_complete(csubstream); |
1805 | if (err < 0) { | 1803 | if (err < 0) { |
1806 | snd_printd("snd_pcm_hw_constraint_complete failed\n"); | 1804 | snd_printd("snd_pcm_hw_constraint_complete failed\n"); |
1807 | snd_pcm_oss_release_file(pcm_oss_file); | 1805 | snd_pcm_oss_release_file(pcm_oss_file); |
1808 | return err; | 1806 | return err; |
1809 | } | 1807 | } |
1810 | csubstream->ffile = file; | ||
1811 | snd_pcm_oss_init_substream(csubstream, csetup, minor); | 1808 | snd_pcm_oss_init_substream(csubstream, csetup, minor); |
1812 | } | 1809 | } |
1813 | 1810 | ||
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index 3920bf0eebbf..4b6307df846d 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c | |||
@@ -103,10 +103,24 @@ struct sndrv_pcm_sw_params32 { | |||
103 | unsigned char reserved[64]; | 103 | unsigned char reserved[64]; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | /* recalcuate the boundary within 32bit */ | ||
107 | static snd_pcm_uframes_t recalculate_boundary(snd_pcm_runtime_t *runtime) | ||
108 | { | ||
109 | snd_pcm_uframes_t boundary; | ||
110 | |||
111 | if (! runtime->buffer_size) | ||
112 | return 0; | ||
113 | boundary = runtime->buffer_size; | ||
114 | while (boundary * 2 <= 0x7fffffffUL - runtime->buffer_size) | ||
115 | boundary *= 2; | ||
116 | return boundary; | ||
117 | } | ||
118 | |||
106 | static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream, | 119 | static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream, |
107 | struct sndrv_pcm_sw_params32 __user *src) | 120 | struct sndrv_pcm_sw_params32 __user *src) |
108 | { | 121 | { |
109 | snd_pcm_sw_params_t params; | 122 | snd_pcm_sw_params_t params; |
123 | snd_pcm_uframes_t boundary; | ||
110 | int err; | 124 | int err; |
111 | 125 | ||
112 | memset(¶ms, 0, sizeof(params)); | 126 | memset(¶ms, 0, sizeof(params)); |
@@ -120,10 +134,17 @@ static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream, | |||
120 | get_user(params.silence_threshold, &src->silence_threshold) || | 134 | get_user(params.silence_threshold, &src->silence_threshold) || |
121 | get_user(params.silence_size, &src->silence_size)) | 135 | get_user(params.silence_size, &src->silence_size)) |
122 | return -EFAULT; | 136 | return -EFAULT; |
137 | /* | ||
138 | * Check silent_size parameter. Since we have 64bit boundary, | ||
139 | * silence_size must be compared with the 32bit boundary. | ||
140 | */ | ||
141 | boundary = recalculate_boundary(substream->runtime); | ||
142 | if (boundary && params.silence_size >= boundary) | ||
143 | params.silence_size = substream->runtime->boundary; | ||
123 | err = snd_pcm_sw_params(substream, ¶ms); | 144 | err = snd_pcm_sw_params(substream, ¶ms); |
124 | if (err < 0) | 145 | if (err < 0) |
125 | return err; | 146 | return err; |
126 | if (put_user(params.boundary, &src->boundary)) | 147 | if (boundary && put_user(boundary, &src->boundary)) |
127 | return -EFAULT; | 148 | return -EFAULT; |
128 | return err; | 149 | return err; |
129 | } | 150 | } |
@@ -199,16 +220,6 @@ static int snd_pcm_status_user_compat(snd_pcm_substream_t *substream, | |||
199 | return err; | 220 | return err; |
200 | } | 221 | } |
201 | 222 | ||
202 | /* recalcuate the boundary within 32bit */ | ||
203 | static void recalculate_boundary(snd_pcm_runtime_t *runtime) | ||
204 | { | ||
205 | if (! runtime->buffer_size) | ||
206 | return; | ||
207 | runtime->boundary = runtime->buffer_size; | ||
208 | while (runtime->boundary * 2 <= 0x7fffffffUL - runtime->buffer_size) | ||
209 | runtime->boundary *= 2; | ||
210 | } | ||
211 | |||
212 | /* both for HW_PARAMS and HW_REFINE */ | 223 | /* both for HW_PARAMS and HW_REFINE */ |
213 | static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream, | 224 | static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream, |
214 | int refine, | 225 | int refine, |
@@ -241,8 +252,11 @@ static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream, | |||
241 | goto error; | 252 | goto error; |
242 | } | 253 | } |
243 | 254 | ||
244 | if (! refine) | 255 | if (! refine) { |
245 | recalculate_boundary(runtime); | 256 | unsigned int new_boundary = recalculate_boundary(runtime); |
257 | if (new_boundary) | ||
258 | runtime->boundary = new_boundary; | ||
259 | } | ||
246 | error: | 260 | error: |
247 | kfree(data); | 261 | kfree(data); |
248 | return err; | 262 | return err; |
@@ -380,6 +394,7 @@ static int snd_pcm_ioctl_sync_ptr_compat(snd_pcm_substream_t *substream, | |||
380 | u32 sflags; | 394 | u32 sflags; |
381 | struct sndrv_pcm_mmap_control scontrol; | 395 | struct sndrv_pcm_mmap_control scontrol; |
382 | struct sndrv_pcm_mmap_status sstatus; | 396 | struct sndrv_pcm_mmap_status sstatus; |
397 | snd_pcm_uframes_t boundary; | ||
383 | int err; | 398 | int err; |
384 | 399 | ||
385 | snd_assert(runtime, return -EINVAL); | 400 | snd_assert(runtime, return -EINVAL); |
@@ -395,17 +410,21 @@ static int snd_pcm_ioctl_sync_ptr_compat(snd_pcm_substream_t *substream, | |||
395 | } | 410 | } |
396 | status = runtime->status; | 411 | status = runtime->status; |
397 | control = runtime->control; | 412 | control = runtime->control; |
413 | boundary = recalculate_boundary(runtime); | ||
414 | if (! boundary) | ||
415 | boundary = 0x7fffffff; | ||
398 | snd_pcm_stream_lock_irq(substream); | 416 | snd_pcm_stream_lock_irq(substream); |
417 | /* FIXME: we should consider the boundary for the sync from app */ | ||
399 | if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) | 418 | if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) |
400 | control->appl_ptr = scontrol.appl_ptr; | 419 | control->appl_ptr = scontrol.appl_ptr; |
401 | else | 420 | else |
402 | scontrol.appl_ptr = control->appl_ptr; | 421 | scontrol.appl_ptr = control->appl_ptr % boundary; |
403 | if (!(sflags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN)) | 422 | if (!(sflags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN)) |
404 | control->avail_min = scontrol.avail_min; | 423 | control->avail_min = scontrol.avail_min; |
405 | else | 424 | else |
406 | scontrol.avail_min = control->avail_min; | 425 | scontrol.avail_min = control->avail_min; |
407 | sstatus.state = status->state; | 426 | sstatus.state = status->state; |
408 | sstatus.hw_ptr = status->hw_ptr; | 427 | sstatus.hw_ptr = status->hw_ptr % boundary; |
409 | sstatus.tstamp = status->tstamp; | 428 | sstatus.tstamp = status->tstamp; |
410 | sstatus.suspended_state = status->suspended_state; | 429 | sstatus.suspended_state = status->suspended_state; |
411 | snd_pcm_stream_unlock_irq(substream); | 430 | snd_pcm_stream_unlock_irq(substream); |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index c5bfd0918cff..0082914a7e33 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -1584,8 +1584,8 @@ int snd_pcm_hw_param_set(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, | |||
1584 | return snd_pcm_hw_param_value(params, var, NULL); | 1584 | return snd_pcm_hw_param_value(params, var, NULL); |
1585 | } | 1585 | } |
1586 | 1586 | ||
1587 | int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params, | 1587 | static int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params, |
1588 | snd_pcm_hw_param_t var, const snd_mask_t *val) | 1588 | snd_pcm_hw_param_t var, const snd_mask_t *val) |
1589 | { | 1589 | { |
1590 | int changed; | 1590 | int changed; |
1591 | assert(hw_is_mask(var)); | 1591 | assert(hw_is_mask(var)); |
@@ -2063,7 +2063,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, | |||
2063 | if (((avail < runtime->control->avail_min && size > avail) || | 2063 | if (((avail < runtime->control->avail_min && size > avail) || |
2064 | (size >= runtime->xfer_align && avail < runtime->xfer_align))) { | 2064 | (size >= runtime->xfer_align && avail < runtime->xfer_align))) { |
2065 | wait_queue_t wait; | 2065 | wait_queue_t wait; |
2066 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED } state; | 2066 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; |
2067 | long tout; | 2067 | long tout; |
2068 | 2068 | ||
2069 | if (nonblock) { | 2069 | if (nonblock) { |
@@ -2097,6 +2097,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, | |||
2097 | case SNDRV_PCM_STATE_SUSPENDED: | 2097 | case SNDRV_PCM_STATE_SUSPENDED: |
2098 | state = SUSPENDED; | 2098 | state = SUSPENDED; |
2099 | goto _end_loop; | 2099 | goto _end_loop; |
2100 | case SNDRV_PCM_STATE_SETUP: | ||
2101 | state = DROPPED; | ||
2102 | goto _end_loop; | ||
2100 | default: | 2103 | default: |
2101 | break; | 2104 | break; |
2102 | } | 2105 | } |
@@ -2123,6 +2126,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, | |||
2123 | snd_printd("playback write error (DMA or IRQ trouble?)\n"); | 2126 | snd_printd("playback write error (DMA or IRQ trouble?)\n"); |
2124 | err = -EIO; | 2127 | err = -EIO; |
2125 | goto _end_unlock; | 2128 | goto _end_unlock; |
2129 | case DROPPED: | ||
2130 | err = -EBADFD; | ||
2131 | goto _end_unlock; | ||
2126 | default: | 2132 | default: |
2127 | break; | 2133 | break; |
2128 | } | 2134 | } |
@@ -2359,7 +2365,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, | |||
2359 | } else if ((avail < runtime->control->avail_min && size > avail) || | 2365 | } else if ((avail < runtime->control->avail_min && size > avail) || |
2360 | (size >= runtime->xfer_align && avail < runtime->xfer_align)) { | 2366 | (size >= runtime->xfer_align && avail < runtime->xfer_align)) { |
2361 | wait_queue_t wait; | 2367 | wait_queue_t wait; |
2362 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED } state; | 2368 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; |
2363 | long tout; | 2369 | long tout; |
2364 | 2370 | ||
2365 | if (nonblock) { | 2371 | if (nonblock) { |
@@ -2394,6 +2400,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, | |||
2394 | goto _end_loop; | 2400 | goto _end_loop; |
2395 | case SNDRV_PCM_STATE_DRAINING: | 2401 | case SNDRV_PCM_STATE_DRAINING: |
2396 | goto __draining; | 2402 | goto __draining; |
2403 | case SNDRV_PCM_STATE_SETUP: | ||
2404 | state = DROPPED; | ||
2405 | goto _end_loop; | ||
2397 | default: | 2406 | default: |
2398 | break; | 2407 | break; |
2399 | } | 2408 | } |
@@ -2420,6 +2429,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, | |||
2420 | snd_printd("capture read error (DMA or IRQ trouble?)\n"); | 2429 | snd_printd("capture read error (DMA or IRQ trouble?)\n"); |
2421 | err = -EIO; | 2430 | err = -EIO; |
2422 | goto _end_unlock; | 2431 | goto _end_unlock; |
2432 | case DROPPED: | ||
2433 | err = -EBADFD; | ||
2434 | goto _end_unlock; | ||
2423 | default: | 2435 | default: |
2424 | break; | 2436 | break; |
2425 | } | 2437 | } |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 10c2c9832649..03c17159dd8e 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1025,7 +1025,7 @@ static void snd_pcm_post_suspend(snd_pcm_substream_t *substream, int state) | |||
1025 | snd_pcm_runtime_t *runtime = substream->runtime; | 1025 | snd_pcm_runtime_t *runtime = substream->runtime; |
1026 | snd_pcm_trigger_tstamp(substream); | 1026 | snd_pcm_trigger_tstamp(substream); |
1027 | if (substream->timer) | 1027 | if (substream->timer) |
1028 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MPAUSE, &runtime->trigger_tstamp); | 1028 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSUSPEND, &runtime->trigger_tstamp); |
1029 | runtime->status->suspended_state = runtime->status->state; | 1029 | runtime->status->suspended_state = runtime->status->state; |
1030 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; | 1030 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; |
1031 | snd_pcm_tick_set(substream, 0); | 1031 | snd_pcm_tick_set(substream, 0); |
@@ -1115,7 +1115,7 @@ static void snd_pcm_post_resume(snd_pcm_substream_t *substream, int state) | |||
1115 | snd_pcm_runtime_t *runtime = substream->runtime; | 1115 | snd_pcm_runtime_t *runtime = substream->runtime; |
1116 | snd_pcm_trigger_tstamp(substream); | 1116 | snd_pcm_trigger_tstamp(substream); |
1117 | if (substream->timer) | 1117 | if (substream->timer) |
1118 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MCONTINUE, &runtime->trigger_tstamp); | 1118 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, &runtime->trigger_tstamp); |
1119 | runtime->status->state = runtime->status->suspended_state; | 1119 | runtime->status->state = runtime->status->suspended_state; |
1120 | if (runtime->sleep_min) | 1120 | if (runtime->sleep_min) |
1121 | snd_pcm_tick_prepare(substream); | 1121 | snd_pcm_tick_prepare(substream); |
@@ -1967,13 +1967,12 @@ static int snd_pcm_release_file(snd_pcm_file_t * pcm_file) | |||
1967 | runtime = substream->runtime; | 1967 | runtime = substream->runtime; |
1968 | str = substream->pstr; | 1968 | str = substream->pstr; |
1969 | snd_pcm_unlink(substream); | 1969 | snd_pcm_unlink(substream); |
1970 | if (substream->open_flag) { | 1970 | if (substream->ffile != NULL) { |
1971 | if (substream->ops->hw_free != NULL) | 1971 | if (substream->ops->hw_free != NULL) |
1972 | substream->ops->hw_free(substream); | 1972 | substream->ops->hw_free(substream); |
1973 | substream->ops->close(substream); | 1973 | substream->ops->close(substream); |
1974 | substream->open_flag = 0; | 1974 | substream->ffile = NULL; |
1975 | } | 1975 | } |
1976 | substream->ffile = NULL; | ||
1977 | snd_pcm_remove_file(str, pcm_file); | 1976 | snd_pcm_remove_file(str, pcm_file); |
1978 | snd_pcm_release_substream(substream); | 1977 | snd_pcm_release_substream(substream); |
1979 | kfree(pcm_file); | 1978 | kfree(pcm_file); |
@@ -2022,18 +2021,15 @@ static int snd_pcm_open_file(struct file *file, | |||
2022 | snd_pcm_release_file(pcm_file); | 2021 | snd_pcm_release_file(pcm_file); |
2023 | return err; | 2022 | return err; |
2024 | } | 2023 | } |
2025 | substream->open_flag = 1; | 2024 | substream->ffile = file; |
2026 | 2025 | ||
2027 | err = snd_pcm_hw_constraints_complete(substream); | 2026 | err = snd_pcm_hw_constraints_complete(substream); |
2028 | if (err < 0) { | 2027 | if (err < 0) { |
2029 | snd_printd("snd_pcm_hw_constraints_complete failed\n"); | 2028 | snd_printd("snd_pcm_hw_constraints_complete failed\n"); |
2030 | substream->ops->close(substream); | ||
2031 | snd_pcm_release_file(pcm_file); | 2029 | snd_pcm_release_file(pcm_file); |
2032 | return err; | 2030 | return err; |
2033 | } | 2031 | } |
2034 | 2032 | ||
2035 | substream->ffile = file; | ||
2036 | |||
2037 | file->private_data = pcm_file; | 2033 | file->private_data = pcm_file; |
2038 | *rpcm_file = pcm_file; | 2034 | *rpcm_file = pcm_file; |
2039 | return 0; | 2035 | return 0; |
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index de39d212bc15..e401c6703297 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c | |||
@@ -98,6 +98,7 @@ int snd_register_oss_device(int type, snd_card_t * card, int dev, snd_minor_t * | |||
98 | int cidx = SNDRV_MINOR_OSS_CARD(minor); | 98 | int cidx = SNDRV_MINOR_OSS_CARD(minor); |
99 | int track2 = -1; | 99 | int track2 = -1; |
100 | int register1 = -1, register2 = -1; | 100 | int register1 = -1, register2 = -1; |
101 | struct device *carddev = NULL; | ||
101 | 102 | ||
102 | if (minor < 0) | 103 | if (minor < 0) |
103 | return minor; | 104 | return minor; |
@@ -121,11 +122,13 @@ int snd_register_oss_device(int type, snd_card_t * card, int dev, snd_minor_t * | |||
121 | track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1); | 122 | track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1); |
122 | break; | 123 | break; |
123 | } | 124 | } |
124 | register1 = register_sound_special(reg->f_ops, minor); | 125 | if (card) |
126 | carddev = card->dev; | ||
127 | register1 = register_sound_special_device(reg->f_ops, minor, carddev); | ||
125 | if (register1 != minor) | 128 | if (register1 != minor) |
126 | goto __end; | 129 | goto __end; |
127 | if (track2 >= 0) { | 130 | if (track2 >= 0) { |
128 | register2 = register_sound_special(reg->f_ops, track2); | 131 | register2 = register_sound_special_device(reg->f_ops, track2, carddev); |
129 | if (register2 != track2) | 132 | if (register2 != track2) |
130 | goto __end; | 133 | goto __end; |
131 | } | 134 | } |
diff --git a/sound/core/timer.c b/sound/core/timer.c index cfaccd415b3b..4104f6e292e9 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -799,13 +799,13 @@ static int snd_timer_free(snd_timer_t *timer) | |||
799 | return 0; | 799 | return 0; |
800 | } | 800 | } |
801 | 801 | ||
802 | int snd_timer_dev_free(snd_device_t *device) | 802 | static int snd_timer_dev_free(snd_device_t *device) |
803 | { | 803 | { |
804 | snd_timer_t *timer = device->device_data; | 804 | snd_timer_t *timer = device->device_data; |
805 | return snd_timer_free(timer); | 805 | return snd_timer_free(timer); |
806 | } | 806 | } |
807 | 807 | ||
808 | int snd_timer_dev_register(snd_device_t *dev) | 808 | static int snd_timer_dev_register(snd_device_t *dev) |
809 | { | 809 | { |
810 | snd_timer_t *timer = dev->device_data; | 810 | snd_timer_t *timer = dev->device_data; |
811 | snd_timer_t *timer1; | 811 | snd_timer_t *timer1; |
@@ -880,9 +880,11 @@ void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct t | |||
880 | struct list_head *p, *n; | 880 | struct list_head *p, *n; |
881 | 881 | ||
882 | snd_runtime_check(timer->hw.flags & SNDRV_TIMER_HW_SLAVE, return); | 882 | snd_runtime_check(timer->hw.flags & SNDRV_TIMER_HW_SLAVE, return); |
883 | snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && event <= SNDRV_TIMER_EVENT_MPAUSE, return); | 883 | snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && event <= SNDRV_TIMER_EVENT_MRESUME, return); |
884 | spin_lock_irqsave(&timer->lock, flags); | 884 | spin_lock_irqsave(&timer->lock, flags); |
885 | if (event == SNDRV_TIMER_EVENT_MSTART || event == SNDRV_TIMER_EVENT_MCONTINUE) { | 885 | if (event == SNDRV_TIMER_EVENT_MSTART || |
886 | event == SNDRV_TIMER_EVENT_MCONTINUE || | ||
887 | event == SNDRV_TIMER_EVENT_MRESUME) { | ||
886 | if (timer->hw.c_resolution) | 888 | if (timer->hw.c_resolution) |
887 | resolution = timer->hw.c_resolution(timer); | 889 | resolution = timer->hw.c_resolution(timer); |
888 | else | 890 | else |
@@ -1555,10 +1557,14 @@ static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_ | |||
1555 | (1<<SNDRV_TIMER_EVENT_STOP)| | 1557 | (1<<SNDRV_TIMER_EVENT_STOP)| |
1556 | (1<<SNDRV_TIMER_EVENT_CONTINUE)| | 1558 | (1<<SNDRV_TIMER_EVENT_CONTINUE)| |
1557 | (1<<SNDRV_TIMER_EVENT_PAUSE)| | 1559 | (1<<SNDRV_TIMER_EVENT_PAUSE)| |
1560 | (1<<SNDRV_TIMER_EVENT_SUSPEND)| | ||
1561 | (1<<SNDRV_TIMER_EVENT_RESUME)| | ||
1558 | (1<<SNDRV_TIMER_EVENT_MSTART)| | 1562 | (1<<SNDRV_TIMER_EVENT_MSTART)| |
1559 | (1<<SNDRV_TIMER_EVENT_MSTOP)| | 1563 | (1<<SNDRV_TIMER_EVENT_MSTOP)| |
1560 | (1<<SNDRV_TIMER_EVENT_MCONTINUE)| | 1564 | (1<<SNDRV_TIMER_EVENT_MCONTINUE)| |
1561 | (1<<SNDRV_TIMER_EVENT_MPAUSE))) { | 1565 | (1<<SNDRV_TIMER_EVENT_MPAUSE)| |
1566 | (1<<SNDRV_TIMER_EVENT_MSUSPEND)| | ||
1567 | (1<<SNDRV_TIMER_EVENT_MRESUME))) { | ||
1562 | err = -EINVAL; | 1568 | err = -EINVAL; |
1563 | goto _end; | 1569 | goto _end; |
1564 | } | 1570 | } |