ALSA: pcm: Unify read/write loop
Both __snd_pcm_lib_read() and __snd_pcm_write() functions have almost the same code to loop over samples. For simplification, this patch unifies both as the single helper, __snd_pcm_lib_xfer(). Other than that, there should be no functional change by this patch. Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@ -1072,10 +1072,7 @@ void snd_pcm_set_sync(struct snd_pcm_substream *substream);
|
||||
int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
|
||||
unsigned int cmd, void *arg);
|
||||
void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
|
||||
snd_pcm_sframes_t __snd_pcm_lib_write(struct snd_pcm_substream *substream,
|
||||
void *buf, bool interleaved,
|
||||
snd_pcm_uframes_t frames);
|
||||
snd_pcm_sframes_t __snd_pcm_lib_read(struct snd_pcm_substream *substream,
|
||||
snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
|
||||
void *buf, bool interleaved,
|
||||
snd_pcm_uframes_t frames);
|
||||
|
||||
@ -1083,28 +1080,28 @@ static inline snd_pcm_sframes_t
|
||||
snd_pcm_lib_write(struct snd_pcm_substream *substream,
|
||||
const void __user *buf, snd_pcm_uframes_t frames)
|
||||
{
|
||||
return __snd_pcm_lib_write(substream, (void *)buf, true, frames);
|
||||
return __snd_pcm_lib_xfer(substream, (void *)buf, true, frames);
|
||||
}
|
||||
|
||||
static inline snd_pcm_sframes_t
|
||||
snd_pcm_lib_read(struct snd_pcm_substream *substream,
|
||||
void __user *buf, snd_pcm_uframes_t frames)
|
||||
{
|
||||
return __snd_pcm_lib_read(substream, (void *)buf, true, frames);
|
||||
return __snd_pcm_lib_xfer(substream, (void *)buf, true, frames);
|
||||
}
|
||||
|
||||
static inline snd_pcm_sframes_t
|
||||
snd_pcm_lib_writev(struct snd_pcm_substream *substream,
|
||||
void __user **bufs, snd_pcm_uframes_t frames)
|
||||
{
|
||||
return __snd_pcm_lib_write(substream, (void *)bufs, false, frames);
|
||||
return __snd_pcm_lib_xfer(substream, (void *)bufs, false, frames);
|
||||
}
|
||||
|
||||
static inline snd_pcm_sframes_t
|
||||
snd_pcm_lib_readv(struct snd_pcm_substream *substream,
|
||||
void __user **bufs, snd_pcm_uframes_t frames)
|
||||
{
|
||||
return __snd_pcm_lib_read(substream, (void *)bufs, false, frames);
|
||||
return __snd_pcm_lib_xfer(substream, (void *)bufs, false, frames);
|
||||
}
|
||||
|
||||
int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime);
|
||||
|
Reference in New Issue
Block a user