--- zzzz-none-000/linux-3.10.107/sound/usb/6fire/pcm.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/usb/6fire/pcm.c 2021-02-04 17:41:59.000000000 +0000 @@ -79,32 +79,35 @@ ctrl_rt->usb_streaming = false; ret = ctrl_rt->update_streaming(ctrl_rt); if (ret < 0) { - snd_printk(KERN_ERR PREFIX "error stopping streaming while " - "setting samplerate %d.\n", rates[rt->rate]); + dev_err(&rt->chip->dev->dev, + "error stopping streaming while setting samplerate %d.\n", + rates[rt->rate]); return ret; } ret = ctrl_rt->set_rate(ctrl_rt, rt->rate); if (ret < 0) { - snd_printk(KERN_ERR PREFIX "error setting samplerate %d.\n", - rates[rt->rate]); + dev_err(&rt->chip->dev->dev, + "error setting samplerate %d.\n", + rates[rt->rate]); return ret; } ret = ctrl_rt->set_channels(ctrl_rt, OUT_N_CHANNELS, IN_N_CHANNELS, false, false); if (ret < 0) { - snd_printk(KERN_ERR PREFIX "error initializing channels " - "while setting samplerate %d.\n", - rates[rt->rate]); + dev_err(&rt->chip->dev->dev, + "error initializing channels while setting samplerate %d.\n", + rates[rt->rate]); return ret; } ctrl_rt->usb_streaming = true; ret = ctrl_rt->update_streaming(ctrl_rt); if (ret < 0) { - snd_printk(KERN_ERR PREFIX "error starting streaming while " - "setting samplerate %d.\n", rates[rt->rate]); + dev_err(&rt->chip->dev->dev, + "error starting streaming while setting samplerate %d.\n", + rates[rt->rate]); return ret; } @@ -124,7 +127,7 @@ return &rt->playback; else if (alsa_sub->stream == SNDRV_PCM_STREAM_CAPTURE) return &rt->capture; - snd_printk(KERN_ERR PREFIX "error getting pcm substream slot.\n"); + dev_err(&rt->chip->dev->dev, "error getting pcm substream slot.\n"); return NULL; } @@ -257,7 +260,7 @@ else if (alsa_rt->format == SNDRV_PCM_FORMAT_S24_LE) dest = (u32 *) (urb->buffer); else { - snd_printk(KERN_ERR PREFIX "Unknown sample format."); + dev_err(&rt->chip->dev->dev, "Unknown sample format."); return; } @@ -307,8 +310,8 @@ } if (rt->stream_state == STREAM_DISABLED) { - snd_printk(KERN_ERR PREFIX "internal error: " - "stream disabled in in-urb handler.\n"); + dev_err(&rt->chip->dev->dev, + "internal error: stream disabled in in-urb handler.\n"); return; } @@ -410,7 +413,7 @@ if (!sub) { mutex_unlock(&rt->stream_mutex); - snd_printk(KERN_ERR PREFIX "invalid stream type.\n"); + dev_err(&rt->chip->dev->dev, "invalid stream type.\n"); return -EINVAL; } @@ -450,13 +453,13 @@ static int usb6fire_pcm_hw_params(struct snd_pcm_substream *alsa_sub, struct snd_pcm_hw_params *hw_params) { - return snd_pcm_lib_malloc_pages(alsa_sub, - params_buffer_bytes(hw_params)); + return snd_pcm_lib_alloc_vmalloc_buffer(alsa_sub, + params_buffer_bytes(hw_params)); } static int usb6fire_pcm_hw_free(struct snd_pcm_substream *alsa_sub) { - return snd_pcm_lib_free_pages(alsa_sub); + return snd_pcm_lib_free_vmalloc_buffer(alsa_sub); } static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub) @@ -481,8 +484,9 @@ break; if (rt->rate == ARRAY_SIZE(rates)) { mutex_unlock(&rt->stream_mutex); - snd_printk("invalid rate %d in prepare.\n", - alsa_rt->rate); + dev_err(&rt->chip->dev->dev, + "invalid rate %d in prepare.\n", + alsa_rt->rate); return -EINVAL; } @@ -494,8 +498,8 @@ ret = usb6fire_pcm_stream_start(rt); if (ret) { mutex_unlock(&rt->stream_mutex); - snd_printk(KERN_ERR PREFIX - "could not start pcm stream.\n"); + dev_err(&rt->chip->dev->dev, + "could not start pcm stream.\n"); return ret; } } @@ -560,6 +564,8 @@ .prepare = usb6fire_pcm_prepare, .trigger = usb6fire_pcm_trigger, .pointer = usb6fire_pcm_pointer, + .page = snd_pcm_lib_get_vmalloc_page, + .mmap = snd_pcm_lib_mmap_vmalloc, }; static void usb6fire_pcm_init_urb(struct pcm_urb *urb, @@ -648,7 +654,7 @@ if (ret < 0) { usb6fire_pcm_buffers_destroy(rt); kfree(rt); - snd_printk(KERN_ERR PREFIX "cannot create pcm instance.\n"); + dev_err(&chip->dev->dev, "cannot create pcm instance.\n"); return ret; } @@ -657,15 +663,11 @@ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &pcm_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_ops); - ret = snd_pcm_lib_preallocate_pages_for_all(pcm, - SNDRV_DMA_TYPE_CONTINUOUS, - snd_dma_continuous_data(GFP_KERNEL), - MAX_BUFSIZE, MAX_BUFSIZE); if (ret) { usb6fire_pcm_buffers_destroy(rt); kfree(rt); - snd_printk(KERN_ERR PREFIX - "error preallocating pcm buffers.\n"); + dev_err(&chip->dev->dev, + "error preallocating pcm buffers.\n"); return ret; } rt->instance = pcm; @@ -677,25 +679,16 @@ void usb6fire_pcm_abort(struct sfire_chip *chip) { struct pcm_runtime *rt = chip->pcm; - unsigned long flags; int i; if (rt) { rt->panic = true; - if (rt->playback.instance) { - snd_pcm_stream_lock_irqsave(rt->playback.instance, flags); - snd_pcm_stop(rt->playback.instance, - SNDRV_PCM_STATE_XRUN); - snd_pcm_stream_unlock_irqrestore(rt->playback.instance, flags); - } + if (rt->playback.instance) + snd_pcm_stop_xrun(rt->playback.instance); - if (rt->capture.instance) { - snd_pcm_stream_lock_irqsave(rt->capture.instance, flags); - snd_pcm_stop(rt->capture.instance, - SNDRV_PCM_STATE_XRUN); - snd_pcm_stream_unlock_irqrestore(rt->capture.instance, flags); - } + if (rt->capture.instance) + snd_pcm_stop_xrun(rt->capture.instance); for (i = 0; i < PCM_N_URBS; i++) { usb_poison_urb(&rt->in_urbs[i].instance);