Revert "Merge remote-tracking branch 'linux-2.6.32.y/master' into develop"
[firefly-linux-kernel-4.4.55.git] / sound / usb / caiaq / audio.c
index 8f9b60c5d74c9714e13c58a8bf4590b9e727951d..86b2c3b92df53abafa8188560c4e034ce987ea97 100644 (file)
@@ -62,10 +62,14 @@ static void
 activate_substream(struct snd_usb_caiaqdev *dev,
                   struct snd_pcm_substream *sub)
 {
+       spin_lock(&dev->spinlock);
+
        if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
                dev->sub_playback[sub->number] = sub;
        else
                dev->sub_capture[sub->number] = sub;
+
+       spin_unlock(&dev->spinlock);
 }
 
 static void
@@ -269,16 +273,22 @@ snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub)
 {
        int index = sub->number;
        struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub);
+       snd_pcm_uframes_t ptr;
+
+       spin_lock(&dev->spinlock);
 
        if (dev->input_panic || dev->output_panic)
-               return SNDRV_PCM_POS_XRUN;
+               ptr = SNDRV_PCM_POS_XRUN;
 
        if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
-               return bytes_to_frames(sub->runtime,
+               ptr = bytes_to_frames(sub->runtime,
                                        dev->audio_out_buf_pos[index]);
        else
-               return bytes_to_frames(sub->runtime,
+               ptr = bytes_to_frames(sub->runtime,
                                        dev->audio_in_buf_pos[index]);
+
+       spin_unlock(&dev->spinlock);
+       return ptr;
 }
 
 /* operators for both playback and capture */
@@ -646,6 +656,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev)
        case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_GUITARRIGMOBILE):
                dev->samplerates |= SNDRV_PCM_RATE_192000;
                /* fall thru */
+       case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO2DJ):
        case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ):
        case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ):
                dev->samplerates |= SNDRV_PCM_RATE_88200;