ALSA: pcm: Build OSS writev/readv helpers conditionally
authorTakashi Iwai <tiwai@suse.de>
Sun, 21 May 2017 17:08:57 +0000 (19:08 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 2 Jun 2017 17:38:26 +0000 (19:38 +0200)
The snd_pcm_oss_writev3() and snd_pcm_oss_readv3() are used only in
io.c with CONFIG_SND_PCM_OSS_PLUGINS=y.  Add an ifdef to reduce the
build of these functions.

Along with it, since they are called always for in-kernel copy, reduce
the argument and call snd_pcm_kernel_writev() and *_readv() directly
instead.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/oss/io.c
sound/core/oss/pcm_oss.c
sound/core/oss/pcm_plugin.h

index 6faa1d719206ffee96de25f563a0a70ec5de18c6..d870b2d93135d64a3d35c1d9acfb02b371705b09 100644 (file)
@@ -26,9 +26,9 @@
 #include "pcm_plugin.h"
 
 #define pcm_write(plug,buf,count) snd_pcm_oss_write3(plug,buf,count,1)
-#define pcm_writev(plug,vec,count) snd_pcm_oss_writev3(plug,vec,count,1)
+#define pcm_writev(plug,vec,count) snd_pcm_oss_writev3(plug,vec,count)
 #define pcm_read(plug,buf,count) snd_pcm_oss_read3(plug,buf,count,1)
-#define pcm_readv(plug,vec,count) snd_pcm_oss_readv3(plug,vec,count,1)
+#define pcm_readv(plug,vec,count) snd_pcm_oss_readv3(plug,vec,count)
 
 /*
  *  Basic io plugin
index 2d6a825cfe88c151382ec6985b3ca5aff5ada417..5e1009d959a8b8b56f1ada72368bc49443e80cfc 100644 (file)
@@ -1232,7 +1232,8 @@ snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *p
        return ret;
 }
 
-snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames, int in_kernel)
+#ifdef CONFIG_SND_PCM_OSS_PLUGINS
+snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        int ret;
@@ -1249,8 +1250,7 @@ snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void
                        if (ret < 0)
                                break;
                }
-               ret = __snd_pcm_lib_xfer(substream, bufs, false, frames,
-                                        in_kernel);
+               ret = snd_pcm_kernel_writev(substream, bufs, frames);
                if (ret != -EPIPE && ret != -ESTRPIPE)
                        break;
 
@@ -1262,7 +1262,7 @@ snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void
        return ret;
 }
        
-snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames, int in_kernel)
+snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        int ret;
@@ -1283,13 +1283,13 @@ snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void *
                        if (ret < 0)
                                break;
                }
-               ret = __snd_pcm_lib_xfer(substream, bufs, false, frames,
-                                        in_kernel);
+               ret = snd_pcm_kernel_readv(substream, bufs, frames);
                if (ret != -EPIPE && ret != -ESTRPIPE)
                        break;
        }
        return ret;
 }
+#endif /* CONFIG_SND_PCM_OSS_PLUGINS */
 
 static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const char *buf, size_t bytes, int in_kernel)
 {
index 73c068abaca53094698fad4e1deaa04a281f8bbf..c9cd29d86efda71b4e1a5d8ddc03a4a9e943fbac 100644 (file)
@@ -162,11 +162,9 @@ snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream,
 snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream,
                                    char *ptr, snd_pcm_uframes_t size, int in_kernel);
 snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream,
-                                     void **bufs, snd_pcm_uframes_t frames,
-                                     int in_kernel);
+                                     void **bufs, snd_pcm_uframes_t frames);
 snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream,
-                                    void **bufs, snd_pcm_uframes_t frames,
-                                    int in_kernel);
+                                    void **bufs, snd_pcm_uframes_t frames);
 
 #else