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

ASoC: Name iov_iter argument as iterator instead of buffer

While transitioning ASoC code for iov_iter usages, I kept the argument
name as "buf" as the original code. But, iov_iter is an iterator, and
using the name "buf" may be misleading: the crucial difference is that
iov_iter can be proceeded after the operation, hence it can't be
passed twice, while a simple "buffer" sounds as if reusable.

To make the usage clearer, rename the argument from "buf" to "iter".
There is no functional changes, just names.

Fixes: 66201cacc33d ("ASoC: component: Add generic PCM copy ops")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/CAHk-=wje+VkXjjfVTmK-uJdG_M5=ar14QxAwK+XDiq07k_pzBg@mail.gmail.com
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230831130457.8180-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+7 -7
+2 -2
include/sound/soc-component.h
··· 139 139 struct snd_pcm_audio_tstamp_report *audio_tstamp_report); 140 140 int (*copy)(struct snd_soc_component *component, 141 141 struct snd_pcm_substream *substream, int channel, 142 - unsigned long pos, struct iov_iter *buf, 142 + unsigned long pos, struct iov_iter *iter, 143 143 unsigned long bytes); 144 144 struct page *(*page)(struct snd_soc_component *component, 145 145 struct snd_pcm_substream *substream, ··· 511 511 int snd_soc_pcm_component_sync_stop(struct snd_pcm_substream *substream); 512 512 int snd_soc_pcm_component_copy(struct snd_pcm_substream *substream, 513 513 int channel, unsigned long pos, 514 - struct iov_iter *buf, unsigned long bytes); 514 + struct iov_iter *iter, unsigned long bytes); 515 515 struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream, 516 516 unsigned long offset); 517 517 int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
+2 -2
sound/soc/soc-component.c
··· 1054 1054 1055 1055 int snd_soc_pcm_component_copy(struct snd_pcm_substream *substream, 1056 1056 int channel, unsigned long pos, 1057 - struct iov_iter *buf, unsigned long bytes) 1057 + struct iov_iter *iter, unsigned long bytes) 1058 1058 { 1059 1059 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 1060 1060 struct snd_soc_component *component; ··· 1065 1065 if (component->driver->copy) 1066 1066 return soc_component_ret(component, 1067 1067 component->driver->copy(component, substream, 1068 - channel, pos, buf, bytes)); 1068 + channel, pos, iter, bytes)); 1069 1069 1070 1070 return -EINVAL; 1071 1071 }
+3 -3
sound/soc/soc-generic-dmaengine-pcm.c
··· 290 290 static int dmaengine_copy(struct snd_soc_component *component, 291 291 struct snd_pcm_substream *substream, 292 292 int channel, unsigned long hwoff, 293 - struct iov_iter *buf, unsigned long bytes) 293 + struct iov_iter *iter, unsigned long bytes) 294 294 { 295 295 struct snd_pcm_runtime *runtime = substream->runtime; 296 296 struct dmaengine_pcm *pcm = soc_component_to_pcm(component); ··· 302 302 channel * (runtime->dma_bytes / runtime->channels); 303 303 304 304 if (is_playback) 305 - if (copy_from_iter(dma_ptr, bytes, buf) != bytes) 305 + if (copy_from_iter(dma_ptr, bytes, iter) != bytes) 306 306 return -EFAULT; 307 307 308 308 if (process) { ··· 312 312 } 313 313 314 314 if (!is_playback) 315 - if (copy_to_iter(dma_ptr, bytes, buf) != bytes) 315 + if (copy_to_iter(dma_ptr, bytes, iter) != bytes) 316 316 return -EFAULT; 317 317 318 318 return 0;