diff options
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r-- | sound/core/pcm_native.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 1c6be91dfb9..25ed9fe41b8 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -20,10 +20,11 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/module.h> | ||
23 | #include <linux/file.h> | 24 | #include <linux/file.h> |
24 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
25 | #include <linux/time.h> | 26 | #include <linux/time.h> |
26 | #include <linux/pm_qos_params.h> | 27 | #include <linux/pm_qos.h> |
27 | #include <linux/uio.h> | 28 | #include <linux/uio.h> |
28 | #include <linux/dma-mapping.h> | 29 | #include <linux/dma-mapping.h> |
29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
@@ -2058,16 +2059,12 @@ EXPORT_SYMBOL(snd_pcm_open_substream); | |||
2058 | 2059 | ||
2059 | static int snd_pcm_open_file(struct file *file, | 2060 | static int snd_pcm_open_file(struct file *file, |
2060 | struct snd_pcm *pcm, | 2061 | struct snd_pcm *pcm, |
2061 | int stream, | 2062 | int stream) |
2062 | struct snd_pcm_file **rpcm_file) | ||
2063 | { | 2063 | { |
2064 | struct snd_pcm_file *pcm_file; | 2064 | struct snd_pcm_file *pcm_file; |
2065 | struct snd_pcm_substream *substream; | 2065 | struct snd_pcm_substream *substream; |
2066 | int err; | 2066 | int err; |
2067 | 2067 | ||
2068 | if (rpcm_file) | ||
2069 | *rpcm_file = NULL; | ||
2070 | |||
2071 | err = snd_pcm_open_substream(pcm, stream, file, &substream); | 2068 | err = snd_pcm_open_substream(pcm, stream, file, &substream); |
2072 | if (err < 0) | 2069 | if (err < 0) |
2073 | return err; | 2070 | return err; |
@@ -2083,8 +2080,7 @@ static int snd_pcm_open_file(struct file *file, | |||
2083 | substream->pcm_release = pcm_release_private; | 2080 | substream->pcm_release = pcm_release_private; |
2084 | } | 2081 | } |
2085 | file->private_data = pcm_file; | 2082 | file->private_data = pcm_file; |
2086 | if (rpcm_file) | 2083 | |
2087 | *rpcm_file = pcm_file; | ||
2088 | return 0; | 2084 | return 0; |
2089 | } | 2085 | } |
2090 | 2086 | ||
@@ -2113,7 +2109,6 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file) | |||
2113 | static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) | 2109 | static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) |
2114 | { | 2110 | { |
2115 | int err; | 2111 | int err; |
2116 | struct snd_pcm_file *pcm_file; | ||
2117 | wait_queue_t wait; | 2112 | wait_queue_t wait; |
2118 | 2113 | ||
2119 | if (pcm == NULL) { | 2114 | if (pcm == NULL) { |
@@ -2131,7 +2126,7 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) | |||
2131 | add_wait_queue(&pcm->open_wait, &wait); | 2126 | add_wait_queue(&pcm->open_wait, &wait); |
2132 | mutex_lock(&pcm->open_mutex); | 2127 | mutex_lock(&pcm->open_mutex); |
2133 | while (1) { | 2128 | while (1) { |
2134 | err = snd_pcm_open_file(file, pcm, stream, &pcm_file); | 2129 | err = snd_pcm_open_file(file, pcm, stream); |
2135 | if (err >= 0) | 2130 | if (err >= 0) |
2136 | break; | 2131 | break; |
2137 | if (err == -EAGAIN) { | 2132 | if (err == -EAGAIN) { |
@@ -3156,8 +3151,8 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = { | |||
3156 | /* | 3151 | /* |
3157 | * mmap the DMA buffer on RAM | 3152 | * mmap the DMA buffer on RAM |
3158 | */ | 3153 | */ |
3159 | static int snd_pcm_default_mmap(struct snd_pcm_substream *substream, | 3154 | int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, |
3160 | struct vm_area_struct *area) | 3155 | struct vm_area_struct *area) |
3161 | { | 3156 | { |
3162 | area->vm_flags |= VM_RESERVED; | 3157 | area->vm_flags |= VM_RESERVED; |
3163 | #ifdef ARCH_HAS_DMA_MMAP_COHERENT | 3158 | #ifdef ARCH_HAS_DMA_MMAP_COHERENT |
@@ -3177,6 +3172,7 @@ static int snd_pcm_default_mmap(struct snd_pcm_substream *substream, | |||
3177 | area->vm_ops = &snd_pcm_vm_ops_data_fault; | 3172 | area->vm_ops = &snd_pcm_vm_ops_data_fault; |
3178 | return 0; | 3173 | return 0; |
3179 | } | 3174 | } |
3175 | EXPORT_SYMBOL_GPL(snd_pcm_lib_default_mmap); | ||
3180 | 3176 | ||
3181 | /* | 3177 | /* |
3182 | * mmap the DMA buffer on I/O memory area | 3178 | * mmap the DMA buffer on I/O memory area |
@@ -3242,7 +3238,7 @@ int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, | |||
3242 | if (substream->ops->mmap) | 3238 | if (substream->ops->mmap) |
3243 | err = substream->ops->mmap(substream, area); | 3239 | err = substream->ops->mmap(substream, area); |
3244 | else | 3240 | else |
3245 | err = snd_pcm_default_mmap(substream, area); | 3241 | err = snd_pcm_lib_default_mmap(substream, area); |
3246 | if (!err) | 3242 | if (!err) |
3247 | atomic_inc(&substream->mmap_count); | 3243 | atomic_inc(&substream->mmap_count); |
3248 | return err; | 3244 | return err; |