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.
Change-Id: I20674598b00bf933a0fe08eb77c122df6cdf3369
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Eric Laurent <elaurent@google.com>
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index 5c673c7..e8fa7fe 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -123,7 +123,7 @@
int (*trigger)(struct snd_compr_stream *stream, int cmd);
int (*pointer)(struct snd_compr_stream *stream,
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);
int (*mmap)(struct snd_compr_stream *stream,
struct vm_area_struct *vma);
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index 212756d..204e8ad 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -279,10 +279,12 @@
if (avail > count)
avail = count;
- if (stream->ops->copy)
- retval = stream->ops->copy(stream, buf, avail);
- else
+ if (stream->ops->copy) {
+ char __user* cbuf = (char __user*)buf;
+ retval = stream->ops->copy(stream, cbuf, avail);
+ } else {
retval = snd_compr_write_data(stream, buf, avail);
+ }
if (retval > 0)
stream->runtime->total_bytes_available += retval;
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 66f9ce6..4b54ad6 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -584,7 +584,7 @@
}
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_platform *platform = rtd->platform;