diff options
Diffstat (limited to 'sound/usb/caiaq/audio.c')
-rw-r--r-- | sound/usb/caiaq/audio.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index 121af0644fd9..86b2c3b92df5 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c | |||
@@ -62,10 +62,14 @@ static void | |||
62 | activate_substream(struct snd_usb_caiaqdev *dev, | 62 | activate_substream(struct snd_usb_caiaqdev *dev, |
63 | struct snd_pcm_substream *sub) | 63 | struct snd_pcm_substream *sub) |
64 | { | 64 | { |
65 | spin_lock(&dev->spinlock); | ||
66 | |||
65 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) | 67 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) |
66 | dev->sub_playback[sub->number] = sub; | 68 | dev->sub_playback[sub->number] = sub; |
67 | else | 69 | else |
68 | dev->sub_capture[sub->number] = sub; | 70 | dev->sub_capture[sub->number] = sub; |
71 | |||
72 | spin_unlock(&dev->spinlock); | ||
69 | } | 73 | } |
70 | 74 | ||
71 | static void | 75 | static void |
@@ -269,16 +273,22 @@ snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub) | |||
269 | { | 273 | { |
270 | int index = sub->number; | 274 | int index = sub->number; |
271 | struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); | 275 | struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); |
276 | snd_pcm_uframes_t ptr; | ||
277 | |||
278 | spin_lock(&dev->spinlock); | ||
272 | 279 | ||
273 | if (dev->input_panic || dev->output_panic) | 280 | if (dev->input_panic || dev->output_panic) |
274 | return SNDRV_PCM_POS_XRUN; | 281 | ptr = SNDRV_PCM_POS_XRUN; |
275 | 282 | ||
276 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) | 283 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) |
277 | return bytes_to_frames(sub->runtime, | 284 | ptr = bytes_to_frames(sub->runtime, |
278 | dev->audio_out_buf_pos[index]); | 285 | dev->audio_out_buf_pos[index]); |
279 | else | 286 | else |
280 | return bytes_to_frames(sub->runtime, | 287 | ptr = bytes_to_frames(sub->runtime, |
281 | dev->audio_in_buf_pos[index]); | 288 | dev->audio_in_buf_pos[index]); |
289 | |||
290 | spin_unlock(&dev->spinlock); | ||
291 | return ptr; | ||
282 | } | 292 | } |
283 | 293 | ||
284 | /* operators for both playback and capture */ | 294 | /* operators for both playback and capture */ |