ASoC: update snd_pcm_ops copy interface in platform drivers

snd_pcm_ops copy interface used by msm platform drivers is replaced
with copy_user in msm-4.14. Unit of two input variables is changed
from frame count to byte.
Update all the related msm platform drivers to adapt to this change.

Change-Id: Icecd0454c7a80e5ee90407c64aaf1ca76d2d9815
Signed-off-by: Meng Wang <mwang@codeaurora.org>
This commit is contained in:
Meng Wang
2017-10-30 16:46:16 +08:00
parent 3c88f61439
commit ac147b705e
8 changed files with 89 additions and 109 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2014, 2017-2018 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -217,24 +217,21 @@ static void dtmf_rx_detected_cb(uint8_t *pkt,
}
static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
int channel, snd_pcm_uframes_t hwoff,
void __user *buf, snd_pcm_uframes_t frames)
int channel, unsigned long hwoff,
void __user *buf, unsigned long fbytes)
{
int ret = 0;
int count = 0;
struct dtmf_buf_node *buf_node = NULL;
struct snd_pcm_runtime *runtime = substream->runtime;
struct dtmf_drv_info *prtd = runtime->private_data;
unsigned long dsp_flags;
count = frames_to_bytes(runtime, frames);
ret = wait_event_interruptible_timeout(prtd->out_wait,
(!list_empty(&prtd->out_queue)),
1 * HZ);
if (ret > 0) {
if (count <= DTMF_PKT_SIZE) {
if (fbytes <= DTMF_PKT_SIZE) {
spin_lock_irqsave(&prtd->dsp_lock, dsp_flags);
buf_node = list_first_entry(&prtd->out_queue,
struct dtmf_buf_node, list);
@@ -242,7 +239,7 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
spin_unlock_irqrestore(&prtd->dsp_lock, dsp_flags);
ret = copy_to_user(buf,
&buf_node->dtmf_det_pkt,
count);
fbytes);
if (ret) {
pr_err("%s: Copy to user returned %d\n",
__func__, ret);
@@ -254,8 +251,8 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
spin_unlock_irqrestore(&prtd->dsp_lock, dsp_flags);
} else {
pr_err("%s: Read count %d > DTMF_PKT_SIZE\n",
__func__, count);
pr_err("%s: Read count %lu > DTMF_PKT_SIZE\n",
__func__, fbytes);
ret = -ENOMEM;
}
} else if (ret == 0) {
@@ -269,14 +266,14 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
}
static int msm_pcm_copy(struct snd_pcm_substream *substream, int a,
snd_pcm_uframes_t hwoff, void __user *buf, snd_pcm_uframes_t frames)
unsigned long hwoff, void __user *buf, unsigned long fbytes)
{
int ret = 0;
pr_debug("%s() DTMF\n", __func__);
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
ret = msm_pcm_capture_copy(substream, a, hwoff, buf, frames);
ret = msm_pcm_capture_copy(substream, a, hwoff, buf, fbytes);
return ret;
}
@@ -524,7 +521,7 @@ static snd_pcm_uframes_t msm_pcm_pointer(struct snd_pcm_substream *substream)
static const struct snd_pcm_ops msm_pcm_ops = {
.open = msm_pcm_open,
.copy = msm_pcm_copy,
.copy_user = msm_pcm_copy,
.hw_params = msm_pcm_hw_params,
.close = msm_pcm_close,
.prepare = msm_pcm_prepare,