All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Cc: linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.de>
Subject: [PATCH 11/25] ALSA: rme96: Convert to generic PCM copy ops
Date: Mon, 14 Aug 2023 13:55:09 +0200	[thread overview]
Message-ID: <20230814115523.15279-12-tiwai@suse.de> (raw)
In-Reply-To: <20230814115523.15279-1-tiwai@suse.de>

This patch converts the rme96 driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/rme96.c | 42 ++++++++----------------------------------
 1 file changed, 8 insertions(+), 34 deletions(-)

diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index bccb7e0d3d11..6b5ffb18197b 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -320,48 +320,26 @@ snd_rme96_playback_silence(struct snd_pcm_substream *substream,
 static int
 snd_rme96_playback_copy(struct snd_pcm_substream *substream,
 			int channel, unsigned long pos,
-			void __user *src, unsigned long count)
+			struct iov_iter *src, unsigned long count)
 {
 	struct rme96 *rme96 = snd_pcm_substream_chip(substream);
 
-	return copy_from_user_toio(rme96->iobase + RME96_IO_PLAY_BUFFER + pos,
+	return copy_from_iter_toio(rme96->iobase + RME96_IO_PLAY_BUFFER + pos,
 				   src, count);
 }
 
-static int
-snd_rme96_playback_copy_kernel(struct snd_pcm_substream *substream,
-			       int channel, unsigned long pos,
-			       void *src, unsigned long count)
-{
-	struct rme96 *rme96 = snd_pcm_substream_chip(substream);
-
-	memcpy_toio(rme96->iobase + RME96_IO_PLAY_BUFFER + pos, src, count);
-	return 0;
-}
-
 static int
 snd_rme96_capture_copy(struct snd_pcm_substream *substream,
 		       int channel, unsigned long pos,
-		       void __user *dst, unsigned long count)
+		       struct iov_iter *dst, unsigned long count)
 {
 	struct rme96 *rme96 = snd_pcm_substream_chip(substream);
 
-	return copy_to_user_fromio(dst,
+	return copy_to_iter_fromio(dst,
 				   rme96->iobase + RME96_IO_REC_BUFFER + pos,
 				   count);
 }
 
-static int
-snd_rme96_capture_copy_kernel(struct snd_pcm_substream *substream,
-			      int channel, unsigned long pos,
-			      void *dst, unsigned long count)
-{
-	struct rme96 *rme96 = snd_pcm_substream_chip(substream);
-
-	memcpy_fromio(dst, rme96->iobase + RME96_IO_REC_BUFFER + pos, count);
-	return 0;
-}
-
 /*
  * Digital output capabilities (S/PDIF)
  */
@@ -1518,8 +1496,7 @@ static const struct snd_pcm_ops snd_rme96_playback_spdif_ops = {
 	.prepare =	snd_rme96_playback_prepare,
 	.trigger =	snd_rme96_playback_trigger,
 	.pointer =	snd_rme96_playback_pointer,
-	.copy_user =	snd_rme96_playback_copy,
-	.copy_kernel =	snd_rme96_playback_copy_kernel,
+	.copy =		snd_rme96_playback_copy,
 	.fill_silence =	snd_rme96_playback_silence,
 	.mmap =		snd_pcm_lib_mmap_iomem,
 };
@@ -1531,8 +1508,7 @@ static const struct snd_pcm_ops snd_rme96_capture_spdif_ops = {
 	.prepare =	snd_rme96_capture_prepare,
 	.trigger =	snd_rme96_capture_trigger,
 	.pointer =	snd_rme96_capture_pointer,
-	.copy_user =	snd_rme96_capture_copy,
-	.copy_kernel =	snd_rme96_capture_copy_kernel,
+	.copy =		snd_rme96_capture_copy,
 	.mmap =		snd_pcm_lib_mmap_iomem,
 };
 
@@ -1543,8 +1519,7 @@ static const struct snd_pcm_ops snd_rme96_playback_adat_ops = {
 	.prepare =	snd_rme96_playback_prepare,
 	.trigger =	snd_rme96_playback_trigger,
 	.pointer =	snd_rme96_playback_pointer,
-	.copy_user =	snd_rme96_playback_copy,
-	.copy_kernel =	snd_rme96_playback_copy_kernel,
+	.copy =		snd_rme96_playback_copy,
 	.fill_silence =	snd_rme96_playback_silence,
 	.mmap =		snd_pcm_lib_mmap_iomem,
 };
@@ -1556,8 +1531,7 @@ static const struct snd_pcm_ops snd_rme96_capture_adat_ops = {
 	.prepare =	snd_rme96_capture_prepare,
 	.trigger =	snd_rme96_capture_trigger,
 	.pointer =	snd_rme96_capture_pointer,
-	.copy_user =	snd_rme96_capture_copy,
-	.copy_kernel =	snd_rme96_capture_copy_kernel,
+	.copy =		snd_rme96_capture_copy,
 	.mmap =		snd_pcm_lib_mmap_iomem,
 };
 
-- 
2.35.3


  parent reply	other threads:[~2023-08-14 11:57 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14 11:54 [PATCH 00/25] ALSA: Generic PCM copy ops using iov_iter Takashi Iwai
2023-08-14 11:54 ` [PATCH 01/25] iov_iter: Export import_ubuf() Takashi Iwai
2023-08-14 11:55 ` [PATCH 02/25] ALSA: pcm: Add copy ops with iov_iter Takashi Iwai
2023-08-14 11:55 ` [PATCH 03/25] ALSA: core: Add memory copy helpers between iov_iter and iomem Takashi Iwai
2023-08-15 13:51   ` Andy Shevchenko
2023-08-15 13:54     ` Takashi Iwai
2023-08-14 11:55 ` [PATCH 04/25] ALSA: dummy: Convert to generic PCM copy ops Takashi Iwai
2023-08-15 13:52   ` Andy Shevchenko
2023-08-14 11:55 ` [PATCH 05/25] ALSA: gus: " Takashi Iwai
2023-08-14 11:55 ` [PATCH 06/25] ALSA: emu8000: " Takashi Iwai
2023-08-14 11:55 ` [PATCH 07/25] ALSA: es1938: " Takashi Iwai
2023-08-14 11:55 ` [PATCH 08/25] ALSA: korg1212: " Takashi Iwai
2023-08-15 13:55   ` Andy Shevchenko
2023-08-14 11:55 ` [PATCH 09/25] ALSA: nm256: " Takashi Iwai
2023-08-14 11:55 ` [PATCH 10/25] ALSA: rme32: " Takashi Iwai
2023-08-14 11:55 ` Takashi Iwai [this message]
2023-08-14 11:55 ` [PATCH 12/25] ALSA: hdsp: " Takashi Iwai
2023-08-14 11:55 ` [PATCH 13/25] ALSA: rme9652: " Takashi Iwai
2023-08-14 11:55 ` [PATCH 14/25] ALSA: sh: " Takashi Iwai
2023-08-14 11:55 ` [PATCH 15/25] ALSA: xen: " Takashi Iwai
2023-08-14 11:55 ` [PATCH 16/25] ALSA: pcmtest: Update comment about " Takashi Iwai
2023-08-14 11:55 ` [PATCH 17/25] media: solo6x10: Convert to generic " Takashi Iwai
2023-08-14 12:15   ` Ismael Luceno
2023-08-14 12:17     ` Takashi Iwai
2023-08-14 12:26       ` Ismael Luceno
2023-08-14 11:55 ` [PATCH 18/25] ASoC: component: Add " Takashi Iwai
2023-08-14 12:59   ` Mark Brown
2023-08-15 13:56   ` Andy Shevchenko
2023-08-14 11:55 ` [PATCH 19/25] ASoC: mediatek: Convert to " Takashi Iwai
2023-08-14 13:00   ` Mark Brown
2023-08-15 13:58   ` Andy Shevchenko
2023-08-14 11:55 ` [PATCH 20/25] ASoC: qcom: " Takashi Iwai
2023-08-14 13:06   ` Mark Brown
2023-08-14 11:55 ` [PATCH 21/25] ASoC: dmaengine: " Takashi Iwai
2023-08-14 13:18   ` Mark Brown
2023-08-15 14:00   ` Andy Shevchenko
2023-08-15 14:55     ` Takashi Iwai
2023-08-15 15:45       ` Andy Shevchenko
2023-08-14 11:55 ` [PATCH 22/25] ASoC: dmaengine: Use iov_iter for process callback, too Takashi Iwai
2023-08-14 13:19   ` Mark Brown
2023-08-14 11:55 ` [PATCH 23/25] ALSA: doc: Update description for the new PCM copy ops Takashi Iwai
2023-08-14 11:55 ` [PATCH 24/25] ASoC: pcm: Drop obsoleted PCM copy_user ops Takashi Iwai
2023-08-14 13:19   ` Mark Brown
2023-08-14 11:55 ` [PATCH 25/25] ALSA: pcm: Drop obsoleted PCM copy_user and copy_kernel ops Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230814115523.15279-12-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.