From patchwork Mon Jul 31 15:47:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 708459 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1A50C001DE for ; Mon, 31 Jul 2023 15:50:59 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1E59F836; Mon, 31 Jul 2023 17:50:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1E59F836 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690818658; bh=GzD/OiBqwFwTQoA7/K3mv6VkJidkxuxHBQ470+G/Tyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Boi2jfIDgrRgK22UscPcQa3JqhglobNAVQOM9MR2A0IsPFOtNhUNGiMYIOe7Ha4qP /zylYwLUsrOL1XV/V2V57qckle1AlmkUy6gsslw7NKGNgPEdl2D6qhTXMTlX6jvQfZ F4iG1CV2sWiK2U2cEAV1BF2T055ESVWsn0odIRUs= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 44E88F805E0; Mon, 31 Jul 2023 17:48:03 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 7A278F805E0; Mon, 31 Jul 2023 17:48:02 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C489DF805B1; Mon, 31 Jul 2023 17:47:50 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A38D9F80557 for ; Mon, 31 Jul 2023 17:47:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A38D9F80557 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=gUuRlm5Q; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=jHraE8xB 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-out2.suse.de (Postfix) with ESMTPS id BA67A1F8C2; Mon, 31 Jul 2023 15:47:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1690818446; 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=F4bZzw6ghIKo8Le7pLFTGbdRqYfmO/nvgpbKIlcIbmQ=; b=gUuRlm5QKoFla1olfVq/ETjA34X9hiAXFvFDNI2WrKrYmglFlsdHWSWD8JqOAm5m45bCPJ Nj5AqA7V0abu5pa14OSDjBwIFVeUs3Mn1tas1Mdz2PG4FCdFbjsKV4/1rBoi0Zfzkn4HBU DFteoovV0hrP8sZns/6upCvPc6C2p7Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1690818446; 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=F4bZzw6ghIKo8Le7pLFTGbdRqYfmO/nvgpbKIlcIbmQ=; b=jHraE8xBR736ujjUwsAs4qGove4VUh6r3FbvRsJolUhHRby9senbFnXlgN6Vp6MxJR/PsK egC4ZWd6srUAtBDw== 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 982A11322C; Mon, 31 Jul 2023 15:47:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uKpGJI7Xx2Q3fwAAMHmgww (envelope-from ); Mon, 31 Jul 2023 15:47:26 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai , Lars-Peter Clausen , Mark Brown Subject: [PATCH 20/24] ASoC: dmaengine: Convert to generic PCM copy ops Date: Mon, 31 Jul 2023 17:47:14 +0200 Message-Id: <20230731154718.31048-21-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230731154718.31048-1-tiwai@suse.de> References: <20230731154718.31048-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: 4VKYXQQ7JLEDC4D5FU5IAQGZXP3L3DHZ X-Message-ID-Hash: 4VKYXQQ7JLEDC4D5FU5IAQGZXP3L3DHZ X-MailFrom: tiwai@suse.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This patch converts the ASoC dmaenging driver code to use the new unified PCM copy callback. It's a straightforward conversion from *_user() to *_sockptr() variants. The process callback is still using the direct pointer as of now, but it'll be converted in the next patch. Cc: Lars-Peter Clausen Cc: Mark Brown Signed-off-by: Takashi Iwai --- sound/soc/soc-generic-dmaengine-pcm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 3b99f619e37e..25b8de7e9bb2 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -287,10 +287,10 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer( return snd_dmaengine_pcm_pointer(substream); } -static int dmaengine_copy_user(struct snd_soc_component *component, - struct snd_pcm_substream *substream, - int channel, unsigned long hwoff, - void __user *buf, unsigned long bytes) +static int dmaengine_copy(struct snd_soc_component *component, + struct snd_pcm_substream *substream, + int channel, unsigned long hwoff, + sockptr_t buf, unsigned long bytes) { struct snd_pcm_runtime *runtime = substream->runtime; struct dmaengine_pcm *pcm = soc_component_to_pcm(component); @@ -302,17 +302,17 @@ static int dmaengine_copy_user(struct snd_soc_component *component, channel * (runtime->dma_bytes / runtime->channels); if (is_playback) - if (copy_from_user(dma_ptr, buf, bytes)) + if (copy_from_sockptr(dma_ptr, buf, bytes)) return -EFAULT; if (process) { - int ret = process(substream, channel, hwoff, (__force void *)buf, bytes); + int ret = process(substream, channel, hwoff, buf.kernel, bytes); if (ret < 0) return ret; } if (!is_playback) - if (copy_to_user(buf, dma_ptr, bytes)) + if (copy_to_sockptr(buf, dma_ptr, bytes)) return -EFAULT; return 0; @@ -337,7 +337,7 @@ static const struct snd_soc_component_driver dmaengine_pcm_component_process = { .hw_params = dmaengine_pcm_hw_params, .trigger = dmaengine_pcm_trigger, .pointer = dmaengine_pcm_pointer, - .copy_user = dmaengine_copy_user, + .copy = dmaengine_copy, .pcm_construct = dmaengine_pcm_new, };