Skip to content

Commit 4daf891

Browse files
charleskeepaxtiwai
authored andcommitted
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: 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>
1 parent 5b1f79f commit 4daf891

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

include/sound/compress_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ struct snd_compr_ops {
121121
int (*trigger)(struct snd_compr_stream *stream, int cmd);
122122
int (*pointer)(struct snd_compr_stream *stream,
123123
struct snd_compr_tstamp *tstamp);
124-
int (*copy)(struct snd_compr_stream *stream, const char __user *buf,
124+
int (*copy)(struct snd_compr_stream *stream, char __user *buf,
125125
size_t count);
126126
int (*mmap)(struct snd_compr_stream *stream,
127127
struct vm_area_struct *vma);

sound/core/compress_offload.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,12 @@ static ssize_t snd_compr_write(struct file *f, const char __user *buf,
272272
if (avail > count)
273273
avail = count;
274274

275-
if (stream->ops->copy)
276-
retval = stream->ops->copy(stream, buf, avail);
277-
else
275+
if (stream->ops->copy) {
276+
char __user* cbuf = (char __user*)buf;
277+
retval = stream->ops->copy(stream, cbuf, avail);
278+
} else {
278279
retval = snd_compr_write_data(stream, buf, avail);
280+
}
279281
if (retval > 0)
280282
stream->runtime->total_bytes_available += retval;
281283

sound/soc/soc-compress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream,
315315
}
316316

317317
static int soc_compr_copy(struct snd_compr_stream *cstream,
318-
const char __user *buf, size_t count)
318+
char __user *buf, size_t count)
319319
{
320320
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
321321
struct snd_soc_platform *platform = rtd->platform;

0 commit comments

Comments
 (0)