]> Pileus Git - ~andy/linux/commitdiff
ALSA: compress_core: Deconstify copy callback buffer
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Thu, 18 Apr 2013 10:01:38 +0000 (11:01 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sun, 21 Apr 2013 07:53:00 +0000 (09:53 +0200)
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>
include/sound/compress_driver.h
sound/core/compress_offload.c
sound/soc/soc-compress.c

index ff6c74153fa1045279c4366afc913ca39f9a39ae..db8273a5175ad5b32616662dff0533c78499b5d2 100644 (file)
@@ -121,7 +121,7 @@ struct snd_compr_ops {
        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);
index 1f69863a83d29bc1706ea6bd5b8b594faccd6973..52ca4cce1462551b6c0649934dd21113d4ea31bd 100644 (file)
@@ -272,10 +272,12 @@ static ssize_t snd_compr_write(struct file *f, const char __user *buf,
        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;
 
index 29093a306ea26c83a2b305b0065e8e374053b3bb..da83e5658f624e326980929d2f8b535a00997835 100644 (file)
@@ -315,7 +315,7 @@ static int soc_compr_pointer(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_platform *platform = rtd->platform;