ASoC: dmaengine: Use iov_iter for process callback, too
authorTakashi Iwai <tiwai@suse.de>
Tue, 15 Aug 2023 19:01:33 +0000 (21:01 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 18 Aug 2023 10:19:18 +0000 (12:19 +0200)
Along with the conversion to PCM copy ops, use the iov_iter for the
pointer to be passed to the dmaengine process callback, too.  It
avoids the direct reference of iter_iov_addr(), and it can potentially
help for the drivers to access memory properly (although both atmel
and stm drivers don't use the given buffer address at all for now).

Reviewed-by: Mark Brown <broonie@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
Cc: Olivier Moysan <olivier.moysan@foss.st.com>
Cc: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Link: https://lore.kernel.org/r/20230815190136.8987-23-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/dmaengine_pcm.h
sound/soc/atmel/mchp-pdmc.c
sound/soc/soc-generic-dmaengine-pcm.c
sound/soc/stm/stm32_sai_sub.c

index 2df54cf02cb33c5bc332ae9b64a89b052fa7a454..c9a8bce9a78539f02ef2b83386187c556105857d 100644 (file)
@@ -142,7 +142,7 @@ struct snd_dmaengine_pcm_config {
                        struct snd_pcm_substream *substream);
        int (*process)(struct snd_pcm_substream *substream,
                       int channel, unsigned long hwoff,
-                      void *buf, unsigned long bytes);
+                      struct iov_iter *buf, unsigned long bytes);
        dma_filter_fn compat_filter_fn;
        struct device *dma_dev;
        const char *chan_names[SNDRV_PCM_STREAM_LAST + 1];
index 1a069f4cdcda9a4fb610efdb2acaf108f8c59574..911bc334b41e98171bf2348c03a358cdb2c0d6de 100644 (file)
@@ -954,7 +954,7 @@ static int mchp_pdmc_dt_init(struct mchp_pdmc *dd)
 /* used to clean the channel index found on RHR's MSB */
 static int mchp_pdmc_process(struct snd_pcm_substream *substream,
                             int channel, unsigned long hwoff,
-                            void *buf, unsigned long bytes)
+                            struct iov_iter *buf, unsigned long bytes)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        u8 *dma_ptr = runtime->dma_area + hwoff +
index f2cb75781566c319f91b3b66876d0da774182c30..ff2166525dbce83c64117722b7482e89b9444e35 100644 (file)
@@ -296,18 +296,17 @@ static int dmaengine_copy(struct snd_soc_component *component,
        struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
        int (*process)(struct snd_pcm_substream *substream,
                       int channel, unsigned long hwoff,
-                      void *buf, unsigned long bytes) = pcm->config->process;
+                      struct iov_iter *buf, unsigned long bytes) = pcm->config->process;
        bool is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
        void *dma_ptr = runtime->dma_area + hwoff +
                        channel * (runtime->dma_bytes / runtime->channels);
-       void *ptr = (void __force *)iter_iov_addr(buf);
 
        if (is_playback)
                if (copy_from_iter(dma_ptr, bytes, buf) != bytes)
                        return -EFAULT;
 
        if (process) {
-               int ret = process(substream, channel, hwoff, ptr, bytes);
+               int ret = process(substream, channel, hwoff, buf, bytes);
                if (ret < 0)
                        return ret;
        }
index 271ec5b3378d2423dbbab366a8244a5ba321040e..39f9b4654fa2c2fbc75cd0090e95dec28dba4884 100644 (file)
@@ -1233,7 +1233,7 @@ static const struct snd_soc_dai_ops stm32_sai_pcm_dai_ops = {
 
 static int stm32_sai_pcm_process_spdif(struct snd_pcm_substream *substream,
                                       int channel, unsigned long hwoff,
-                                      void *buf, unsigned long bytes)
+                                      struct iov_iter *buf, unsigned long bytes)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);