Commit 4daf891c authored by Charles Keepax's avatar Charles Keepax Committed by Takashi Iwai

ALSA: compress_core: Deconstify copy callback buffer

The buffer passed to the copy callback should not be const because the
copy callback can be used for capture and playback.
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 5b1f79f7
...@@ -121,7 +121,7 @@ struct snd_compr_ops { ...@@ -121,7 +121,7 @@ struct snd_compr_ops {
int (*trigger)(struct snd_compr_stream *stream, int cmd); int (*trigger)(struct snd_compr_stream *stream, int cmd);
int (*pointer)(struct snd_compr_stream *stream, int (*pointer)(struct snd_compr_stream *stream,
struct snd_compr_tstamp *tstamp); struct snd_compr_tstamp *tstamp);
int (*copy)(struct snd_compr_stream *stream, const char __user *buf, int (*copy)(struct snd_compr_stream *stream, char __user *buf,
size_t count); size_t count);
int (*mmap)(struct snd_compr_stream *stream, int (*mmap)(struct snd_compr_stream *stream,
struct vm_area_struct *vma); struct vm_area_struct *vma);
......
...@@ -272,10 +272,12 @@ static ssize_t snd_compr_write(struct file *f, const char __user *buf, ...@@ -272,10 +272,12 @@ static ssize_t snd_compr_write(struct file *f, const char __user *buf,
if (avail > count) if (avail > count)
avail = count; avail = count;
if (stream->ops->copy) if (stream->ops->copy) {
retval = stream->ops->copy(stream, buf, avail); char __user* cbuf = (char __user*)buf;
else retval = stream->ops->copy(stream, cbuf, avail);
} else {
retval = snd_compr_write_data(stream, buf, avail); retval = snd_compr_write_data(stream, buf, avail);
}
if (retval > 0) if (retval > 0)
stream->runtime->total_bytes_available += retval; stream->runtime->total_bytes_available += retval;
......
...@@ -315,7 +315,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, ...@@ -315,7 +315,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream,
} }
static int soc_compr_copy(struct snd_compr_stream *cstream, static int soc_compr_copy(struct snd_compr_stream *cstream,
const char __user *buf, size_t count) char __user *buf, size_t count)
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_platform *platform = rtd->platform; struct snd_soc_platform *platform = rtd->platform;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment