Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: pcm: Build OSS writev/readv helpers conditionally

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>

+10 -12
+2 -2
sound/core/oss/io.c
··· 26 26 #include "pcm_plugin.h" 27 27 28 28 #define pcm_write(plug,buf,count) snd_pcm_oss_write3(plug,buf,count,1) 29 - #define pcm_writev(plug,vec,count) snd_pcm_oss_writev3(plug,vec,count,1) 29 + #define pcm_writev(plug,vec,count) snd_pcm_oss_writev3(plug,vec,count) 30 30 #define pcm_read(plug,buf,count) snd_pcm_oss_read3(plug,buf,count,1) 31 - #define pcm_readv(plug,vec,count) snd_pcm_oss_readv3(plug,vec,count,1) 31 + #define pcm_readv(plug,vec,count) snd_pcm_oss_readv3(plug,vec,count) 32 32 33 33 /* 34 34 * Basic io plugin
+6 -6
sound/core/oss/pcm_oss.c
··· 1232 1232 return ret; 1233 1233 } 1234 1234 1235 - snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames, int in_kernel) 1235 + #ifdef CONFIG_SND_PCM_OSS_PLUGINS 1236 + snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames) 1236 1237 { 1237 1238 struct snd_pcm_runtime *runtime = substream->runtime; 1238 1239 int ret; ··· 1250 1249 if (ret < 0) 1251 1250 break; 1252 1251 } 1253 - ret = __snd_pcm_lib_xfer(substream, bufs, false, frames, 1254 - in_kernel); 1252 + ret = snd_pcm_kernel_writev(substream, bufs, frames); 1255 1253 if (ret != -EPIPE && ret != -ESTRPIPE) 1256 1254 break; 1257 1255 ··· 1262 1262 return ret; 1263 1263 } 1264 1264 1265 - snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames, int in_kernel) 1265 + snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames) 1266 1266 { 1267 1267 struct snd_pcm_runtime *runtime = substream->runtime; 1268 1268 int ret; ··· 1283 1283 if (ret < 0) 1284 1284 break; 1285 1285 } 1286 - ret = __snd_pcm_lib_xfer(substream, bufs, false, frames, 1287 - in_kernel); 1286 + ret = snd_pcm_kernel_readv(substream, bufs, frames); 1288 1287 if (ret != -EPIPE && ret != -ESTRPIPE) 1289 1288 break; 1290 1289 } 1291 1290 return ret; 1292 1291 } 1292 + #endif /* CONFIG_SND_PCM_OSS_PLUGINS */ 1293 1293 1294 1294 static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const char *buf, size_t bytes, int in_kernel) 1295 1295 {
+2 -4
sound/core/oss/pcm_plugin.h
··· 162 162 snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, 163 163 char *ptr, snd_pcm_uframes_t size, int in_kernel); 164 164 snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, 165 - void **bufs, snd_pcm_uframes_t frames, 166 - int in_kernel); 165 + void **bufs, snd_pcm_uframes_t frames); 167 166 snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, 168 - void **bufs, snd_pcm_uframes_t frames, 169 - int in_kernel); 167 + void **bufs, snd_pcm_uframes_t frames); 170 168 171 169 #else 172 170