diff options
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r-- | drivers/media/video/cx18/cx18-alsa-pcm.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/media/video/cx18/cx18-alsa-pcm.c b/drivers/media/video/cx18/cx18-alsa-pcm.c index b9f42b1d886f..06862a69c7b0 100644 --- a/drivers/media/video/cx18/cx18-alsa-pcm.c +++ b/drivers/media/video/cx18/cx18-alsa-pcm.c | |||
@@ -156,12 +156,15 @@ static int snd_cx18_pcm_capture_open(struct snd_pcm_substream *substream) | |||
156 | int ret; | 156 | int ret; |
157 | 157 | ||
158 | /* Instruct the cx18 to start sending packets */ | 158 | /* Instruct the cx18 to start sending packets */ |
159 | snd_cx18_lock(cxsc); | ||
159 | s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM]; | 160 | s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM]; |
160 | 161 | ||
161 | /* Allocate memory */ | 162 | /* Allocate memory */ |
162 | item = kmalloc(sizeof(struct cx18_open_id), GFP_KERNEL); | 163 | item = kmalloc(sizeof(struct cx18_open_id), GFP_KERNEL); |
163 | if (NULL == item) | 164 | if (NULL == item) { |
165 | snd_cx18_unlock(cxsc); | ||
164 | return -ENOMEM; | 166 | return -ENOMEM; |
167 | } | ||
165 | 168 | ||
166 | item->cx = cx; | 169 | item->cx = cx; |
167 | item->type = s->type; | 170 | item->type = s->type; |
@@ -171,12 +174,14 @@ static int snd_cx18_pcm_capture_open(struct snd_pcm_substream *substream) | |||
171 | if (cx18_claim_stream(item, item->type)) { | 174 | if (cx18_claim_stream(item, item->type)) { |
172 | /* No, it's already in use */ | 175 | /* No, it's already in use */ |
173 | kfree(item); | 176 | kfree(item); |
177 | snd_cx18_unlock(cxsc); | ||
174 | return -EBUSY; | 178 | return -EBUSY; |
175 | } | 179 | } |
176 | 180 | ||
177 | if (test_bit(CX18_F_S_STREAMOFF, &s->s_flags) || | 181 | if (test_bit(CX18_F_S_STREAMOFF, &s->s_flags) || |
178 | test_and_set_bit(CX18_F_S_STREAMING, &s->s_flags)) { | 182 | test_and_set_bit(CX18_F_S_STREAMING, &s->s_flags)) { |
179 | /* We're already streaming. No additional action required */ | 183 | /* We're already streaming. No additional action required */ |
184 | snd_cx18_unlock(cxsc); | ||
180 | return 0; | 185 | return 0; |
181 | } | 186 | } |
182 | 187 | ||
@@ -191,6 +196,7 @@ static int snd_cx18_pcm_capture_open(struct snd_pcm_substream *substream) | |||
191 | /* Not currently streaming, so start it up */ | 196 | /* Not currently streaming, so start it up */ |
192 | set_bit(CX18_F_S_STREAMING, &s->s_flags); | 197 | set_bit(CX18_F_S_STREAMING, &s->s_flags); |
193 | ret = cx18_start_v4l2_encode_stream(s); | 198 | ret = cx18_start_v4l2_encode_stream(s); |
199 | snd_cx18_unlock(cxsc); | ||
194 | 200 | ||
195 | return 0; | 201 | return 0; |
196 | } | 202 | } |
@@ -204,6 +210,7 @@ static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream) | |||
204 | int ret; | 210 | int ret; |
205 | 211 | ||
206 | /* Instruct the cx18 to stop sending packets */ | 212 | /* Instruct the cx18 to stop sending packets */ |
213 | snd_cx18_lock(cxsc); | ||
207 | s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM]; | 214 | s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM]; |
208 | ret = cx18_stop_v4l2_encode_stream(s, 0); | 215 | ret = cx18_stop_v4l2_encode_stream(s, 0); |
209 | clear_bit(CX18_F_S_STREAMING, &s->s_flags); | 216 | clear_bit(CX18_F_S_STREAMING, &s->s_flags); |
@@ -211,6 +218,7 @@ static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream) | |||
211 | cx18_release_stream(s); | 218 | cx18_release_stream(s); |
212 | 219 | ||
213 | cx->pcm_announce_callback = NULL; | 220 | cx->pcm_announce_callback = NULL; |
221 | snd_cx18_unlock(cxsc); | ||
214 | 222 | ||
215 | return 0; | 223 | return 0; |
216 | } | 224 | } |