Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2526402rdg; Mon, 14 Aug 2023 05:35:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtpN1eGxa46HlPGujT66Uvb4FSFIKxK2J9Fkunfb3rLyftBW4FsE9x49lNSHAYK21snnxY X-Received: by 2002:a17:906:23e2:b0:99b:f392:10b0 with SMTP id j2-20020a17090623e200b0099bf39210b0mr7782686ejg.37.1692016544540; Mon, 14 Aug 2023 05:35:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692016544; cv=none; d=google.com; s=arc-20160816; b=LawoeWd3LD/inwOEWVvkWAzlo9SDYwcAEIVa4uBOlQ6MtnzN85N6kcxzhfAIkXoiHp jlfSWgZAgpbY/b3oLrUhoxZsil7oiGyl8cx27EBN7kbnAR9lY1dCj/hoOvArNWkFshCq np3N2Mo6azjitk+4s0dF4AJXjK4sycnonGMal1+uWPivf0O78vXGMF3wlSHBq4wNUXv1 JfhK841RDD0o6xI059NIacLpBcN5RcJ8vIZ8GPxWlscMkWpcGVHxWmrl5ZmuIlp+fttm p3LyB6ULAt49AcnlXb4TWm2XMllaO5R+LcIwb/6V7+T/iwpBftSKG1iVR2cx8B5SbEua Gh7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=KmpMqv9W8iYfflO8sQaY3lJwfHw1dyMQl8ItqzCOPcc=; fh=DP61/jJCya+1W1X7P2vK6pKSD4lkczCotBkmA6jh/us=; b=l6poImAXWEjshytHrMUnx9JuR9WX5nXFamT8XZJMWqDIi7e2Hvjx+8Y4bFegP63n3k zbv9Eruj7g1OZM9X168SaJwwwv7CnduBED4d/Yd74T6n5XYmNN8WRwMM+PxApyO1VxMK 5LG0sIweaW1iRpxmF3DwhhuloM42zwO7pY4IUI4W8V33jdHBYWXHAjePaQw2CJhho1DP 3oLZdkcC/qo4ak2VzU8h4ZpReAcPYOAZXwu0KqRPHGg81CLIO4+T9YLlw+HdqqzS+dRj 8oOAhfXEqcFkqrboxc3Hn1yt7iVg7/8ohrP7I2Z+r64c2MOMsuFQnZWSlqI2d9lzRMkQ Qb+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=bvGEUTw2; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=GfwwALyr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q23-20020a170906941700b0098f99532db4si7109676ejx.664.2023.08.14.05.35.20; Mon, 14 Aug 2023 05:35:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=bvGEUTw2; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=GfwwALyr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233740AbjHNL5L (ORCPT + 99 others); Mon, 14 Aug 2023 07:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232748AbjHNL4h (ORCPT ); Mon, 14 Aug 2023 07:56:37 -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 6E417171B for ; Mon, 14 Aug 2023 04:56:20 -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 2F6FF2199E; Mon, 14 Aug 2023 11:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1692014149; 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=KmpMqv9W8iYfflO8sQaY3lJwfHw1dyMQl8ItqzCOPcc=; b=bvGEUTw2CwAiDiv1mgn4AyDtJvCWFDa3fwh51fjpT5Yi/rUSz12wE7/bFx9mRXXK6cpO1t z236YYDoriOvfCDEGBigeaFIoT9I1YGec9wIDRtvKjR23/Bl2Wb3d6s8oDSZ9RcvLAP8K/ PMMJWTu4OzFnQ46w85ppmthkI2TACeA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1692014149; 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=KmpMqv9W8iYfflO8sQaY3lJwfHw1dyMQl8ItqzCOPcc=; b=GfwwALyrad6hFArGHYPP9TVCTSawZpjZ1OVB2Kr/WdQwh25KElC4La+sY6rJN3iTz61kZJ 3d7303dUOScDtfBw== 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 F2E8B138EE; Mon, 14 Aug 2023 11:55:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 2ModOkQW2mRnMAAAMHmgww (envelope-from ); Mon, 14 Aug 2023 11:55:48 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Takashi Iwai Subject: [PATCH 10/25] ALSA: rme32: Convert to generic PCM copy ops Date: Mon, 14 Aug 2023 13:55:08 +0200 Message-Id: <20230814115523.15279-11-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230814115523.15279-1-tiwai@suse.de> References: <20230814115523.15279-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch converts the rme32 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 --- sound/pci/rme32.c | 50 +++++++++++------------------------------------ 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 9c0ac025e143..02144bbee6d5 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -252,48 +252,24 @@ static int snd_rme32_playback_silence(struct snd_pcm_substream *substream, /* copy callback for halfduplex mode */ static int snd_rme32_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 rme32 *rme32 = snd_pcm_substream_chip(substream); - if (copy_from_user_toio(rme32->iobase + RME32_IO_DATA_BUFFER + pos, - src, count)) - return -EFAULT; - return 0; -} - -static int snd_rme32_playback_copy_kernel(struct snd_pcm_substream *substream, - int channel, unsigned long pos, - void *src, unsigned long count) -{ - struct rme32 *rme32 = snd_pcm_substream_chip(substream); - - memcpy_toio(rme32->iobase + RME32_IO_DATA_BUFFER + pos, src, count); - return 0; + return copy_from_iter_toio(rme32->iobase + RME32_IO_DATA_BUFFER + pos, + src, count); } /* copy callback for halfduplex mode */ static int snd_rme32_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 rme32 *rme32 = snd_pcm_substream_chip(substream); - if (copy_to_user_fromio(dst, - rme32->iobase + RME32_IO_DATA_BUFFER + pos, - count)) - return -EFAULT; - return 0; -} - -static int snd_rme32_capture_copy_kernel(struct snd_pcm_substream *substream, - int channel, unsigned long pos, - void *dst, unsigned long count) -{ - struct rme32 *rme32 = snd_pcm_substream_chip(substream); - - memcpy_fromio(dst, rme32->iobase + RME32_IO_DATA_BUFFER + pos, count); - return 0; + return copy_to_iter_fromio(dst, + rme32->iobase + RME32_IO_DATA_BUFFER + pos, + count); } /* @@ -1194,8 +1170,7 @@ static const struct snd_pcm_ops snd_rme32_playback_spdif_ops = { .prepare = snd_rme32_playback_prepare, .trigger = snd_rme32_pcm_trigger, .pointer = snd_rme32_playback_pointer, - .copy_user = snd_rme32_playback_copy, - .copy_kernel = snd_rme32_playback_copy_kernel, + .copy = snd_rme32_playback_copy, .fill_silence = snd_rme32_playback_silence, .mmap = snd_pcm_lib_mmap_iomem, }; @@ -1207,8 +1182,7 @@ static const struct snd_pcm_ops snd_rme32_capture_spdif_ops = { .prepare = snd_rme32_capture_prepare, .trigger = snd_rme32_pcm_trigger, .pointer = snd_rme32_capture_pointer, - .copy_user = snd_rme32_capture_copy, - .copy_kernel = snd_rme32_capture_copy_kernel, + .copy = snd_rme32_capture_copy, .mmap = snd_pcm_lib_mmap_iomem, }; @@ -1219,8 +1193,7 @@ static const struct snd_pcm_ops snd_rme32_playback_adat_ops = { .prepare = snd_rme32_playback_prepare, .trigger = snd_rme32_pcm_trigger, .pointer = snd_rme32_playback_pointer, - .copy_user = snd_rme32_playback_copy, - .copy_kernel = snd_rme32_playback_copy_kernel, + .copy = snd_rme32_playback_copy, .fill_silence = snd_rme32_playback_silence, .mmap = snd_pcm_lib_mmap_iomem, }; @@ -1232,8 +1205,7 @@ static const struct snd_pcm_ops snd_rme32_capture_adat_ops = { .prepare = snd_rme32_capture_prepare, .trigger = snd_rme32_pcm_trigger, .pointer = snd_rme32_capture_pointer, - .copy_user = snd_rme32_capture_copy, - .copy_kernel = snd_rme32_capture_copy_kernel, + .copy = snd_rme32_capture_copy, .mmap = snd_pcm_lib_mmap_iomem, }; -- 2.35.3