From nobody Thu Dec 18 07:53:36 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D1F3C41513 for ; Tue, 15 Aug 2023 19:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239644AbjHOTCT (ORCPT ); Tue, 15 Aug 2023 15:02:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239765AbjHOTCN (ORCPT ); Tue, 15 Aug 2023 15:02:13 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EB5F213E for ; Tue, 15 Aug 2023 12:01:51 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E365D219A3; Tue, 15 Aug 2023 19:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1692126107; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xEwshEXd5jHzSin+0WURFtdbZgE1smV0MVE5PXNoruQ=; b=MXBQHOYYgfH/bnDoaMxIMU9sASgToyrxBUm30m8PuWlu/pP5JqqJvzzrBpOtgj76DJY1c7 pbTQcR3wzes52tW2kWVN8ugApPC2jTS3erRVA9FGQ4rmB1la2XsHUdm6BwBlNt8/PdcqRq LuubXnRCBl0PcDOzyIbaUw+A7VxykgE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1692126107; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xEwshEXd5jHzSin+0WURFtdbZgE1smV0MVE5PXNoruQ=; b=kaVCJFAtAOnSLajpLtq32S+HTkQCWOElto/vs99aqqdWPdCqOBAN03HyTMDs5wC1qfy/48 wVqb4g/Z9BsXrxBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C567E1390C; Tue, 15 Aug 2023 19:01:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mOkrL5vL22QTVAAAMHmgww (envelope-from ); Tue, 15 Aug 2023 19:01:47 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Takashi Iwai Subject: [PATCH v2 05/25] ALSA: gus: Convert to generic PCM copy ops Date: Tue, 15 Aug 2023 21:01:16 +0200 Message-Id: <20230815190136.8987-6-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230815190136.8987-1-tiwai@suse.de> References: <20230815190136.8987-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This patch converts the GUS driver code to use the new unified PCM copy callback. It's a straightforward conversion from *_user() to *_iter() variants. Note that copy_from/to_iter() returns the copied bytes, hence the error condition is adjusted accordingly. Signed-off-by: Takashi Iwai --- sound/isa/gus/gus_pcm.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index 388db5fb65bd..850544725da7 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c @@ -369,7 +369,7 @@ static int playback_copy_ack(struct snd_pcm_substream *= substream, =20 static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream, int voice, unsigned long pos, - void __user *src, unsigned long count) + struct iov_iter *src, unsigned long count) { struct snd_pcm_runtime *runtime =3D substream->runtime; struct gus_pcm_private *pcmp =3D runtime->private_data; @@ -379,27 +379,11 @@ static int snd_gf1_pcm_playback_copy(struct snd_pcm_s= ubstream *substream, bpos =3D get_bpos(pcmp, voice, pos, len); if (bpos < 0) return pos; - if (copy_from_user(runtime->dma_area + bpos, src, len)) + if (copy_from_iter(runtime->dma_area + bpos, len, src) !=3D len) return -EFAULT; return playback_copy_ack(substream, bpos, len); } =20 -static int snd_gf1_pcm_playback_copy_kernel(struct snd_pcm_substream *subs= tream, - int voice, unsigned long pos, - void *src, unsigned long count) -{ - struct snd_pcm_runtime *runtime =3D substream->runtime; - struct gus_pcm_private *pcmp =3D runtime->private_data; - unsigned int len =3D count; - int bpos; - - bpos =3D get_bpos(pcmp, voice, pos, len); - if (bpos < 0) - return pos; - memcpy(runtime->dma_area + bpos, src, len); - return playback_copy_ack(substream, bpos, len); -} - static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substrea= m, int voice, unsigned long pos, unsigned long count) @@ -830,8 +814,7 @@ static const struct snd_pcm_ops snd_gf1_pcm_playback_op= s =3D { .prepare =3D snd_gf1_pcm_playback_prepare, .trigger =3D snd_gf1_pcm_playback_trigger, .pointer =3D snd_gf1_pcm_playback_pointer, - .copy_user =3D snd_gf1_pcm_playback_copy, - .copy_kernel =3D snd_gf1_pcm_playback_copy_kernel, + .copy =3D snd_gf1_pcm_playback_copy, .fill_silence =3D snd_gf1_pcm_playback_silence, }; =20 --=20 2.35.3