Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2523673rdg; Mon, 14 Aug 2023 05:30:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG66ZvkYMZOre6U+kiCajG7yEXvLR5LGjOlLoBThKRhnrZnFIIFu9sxMH+VoyIDTObUTjlh X-Received: by 2002:a17:902:d507:b0:1bb:7996:b269 with SMTP id b7-20020a170902d50700b001bb7996b269mr12713399plg.19.1692016256487; Mon, 14 Aug 2023 05:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692016256; cv=none; d=google.com; s=arc-20160816; b=NjPBF4QR8FmHds6BETtbj+v2YVMBRcY5+4X85CZ5xr8QYijSkx+Pei/zdcZETnI8cP KdZTgYj31NnE3PH8FxqrfbuYHdEcFUhWVpnaFE+w9X2EI4gdQ0/+KLcr7ArMrE3w9+h1 crTSrnAfnQThOshC0Ls4ABjfz6YYR/p1osnFGn3DoPsGn87jP18HZOYUKCbw3j7OLNbD 6wYK8Kn8zPONJMKt0pkZJ8cA163SoxIyfkji2KCd0MqF97KL/xuLo32nch1X3uDyOPfU 8/z+J+63knaR66c+/QBgAP7L/Sb5h3S4hcAps8jnqA1sypGExCgncA1li77y7fReV5Qu n4aA== 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=oTvdESTc9PcredvOts1lRbqh/E0+ltHWoLxYeIHw25k=; fh=ROQsUAJ0MbgEApL13pWIdY28DtILxwxtCCXDzIlCNiA=; b=wKCv6GOtKuLR0loXpgHyjjp2eN52xFKux5rNoaMsuq4AZOh2l1W0FXh5JqohBwAz93 u12w+ptHuLmYJVp1ajGkyc3pVCddsfRlbz6B6frjLXM+OHzBK9DzLBOEUQ1IA64EPLcF yTMvTP8OcJEZGcSiDk8H8MrwpFVEjo+aCZ4FhU/+IRWAbQOKG/nhOmleXrLxeOmaVPkm fJQPQ5Sf5nE1Kkzpf640IQmyCYJXnppom+h8Ve+3AmEG1sw+UxQkI8ntxaXu3YP7osJh 3R6hCrJKnCvDy45GXf7Dt1sax/2n6lCQ5/m1luwlMOxgLzQi4nmeDHUegqHoK/3tVj5l rZDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=xLHuGkce; dkim=neutral (no key) header.i=@suse.de; 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 u4-20020a170903108400b001bb1d822685si7713085pld.358.2023.08.14.05.30.42; Mon, 14 Aug 2023 05:30:56 -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=xLHuGkce; dkim=neutral (no key) header.i=@suse.de; 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 S232705AbjHNL5g (ORCPT + 99 others); Mon, 14 Aug 2023 07:57:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233122AbjHNL4s (ORCPT ); Mon, 14 Aug 2023 07:56:48 -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 36E4E199F for ; Mon, 14 Aug 2023 04:56:32 -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 C8F99219A4; Mon, 14 Aug 2023 11:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1692014154; 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=oTvdESTc9PcredvOts1lRbqh/E0+ltHWoLxYeIHw25k=; b=xLHuGkceY3pDLyVyOFaW1sPguGNiznPHax4v/QjRpdOt1HI0E+qn3dFbge2paKoXgmI3FU CS93lORiP09/MdSG+C3dHQLtJ5YnzTEfR+tRTCECKwsL9UavkFKYH0O3FLiVhHTOHprzQA nbk90GXXCq6LCGI66LGzv/RUjVY3/s4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1692014154; 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=oTvdESTc9PcredvOts1lRbqh/E0+ltHWoLxYeIHw25k=; b=IKI770GZBLchgkZhozf7bS2EtlwktddI6RPq6ms1kkyHb2/VCwe/8jCh5+clpAvna0aQih qzZkysbvAfTKK8Dw== 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 96EAB138EE; Mon, 14 Aug 2023 11:55:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4APBI0oW2mRnMAAAMHmgww (envelope-from ); Mon, 14 Aug 2023 11:55:54 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Takashi Iwai , Srinivas Kandagatla , Banajit Goswami , Mark Brown Subject: [PATCH 20/25] ASoC: qcom: Convert to generic PCM copy ops Date: Mon, 14 Aug 2023 13:55:18 +0200 Message-Id: <20230814115523.15279-21-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 qcom lpass 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 inverted from copy_from/to_user(). Cc: Srinivas Kandagatla Cc: Banajit Goswami Cc: Mark Brown Signed-off-by: Takashi Iwai --- sound/soc/qcom/lpass-platform.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index ef5cb40b2d9b..4ab6ac085b84 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c @@ -1219,7 +1219,8 @@ static int lpass_platform_pcmops_resume(struct snd_soc_component *component) static int lpass_platform_copy(struct snd_soc_component *component, struct snd_pcm_substream *substream, int channel, - unsigned long pos, void __user *buf, unsigned long bytes) + unsigned long pos, struct iov_iter *buf, + unsigned long bytes) { struct snd_pcm_runtime *rt = substream->runtime; unsigned int dai_id = component->id; @@ -1230,16 +1231,16 @@ static int lpass_platform_copy(struct snd_soc_component *component, if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (is_cdc_dma_port(dai_id)) { - ret = copy_from_user_toio(dma_buf, buf, bytes); + ret = copy_from_iter_toio(dma_buf, buf, bytes); } else { - if (copy_from_user((void __force *)dma_buf, buf, bytes)) + if (!copy_from_iter((void __force *)dma_buf, bytes, buf)) ret = -EFAULT; } } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { if (is_cdc_dma_port(dai_id)) { - ret = copy_to_user_fromio(buf, dma_buf, bytes); + ret = copy_to_iter_fromio(buf, dma_buf, bytes); } else { - if (copy_to_user(buf, (void __force *)dma_buf, bytes)) + if (!copy_to_iter((void __force *)dma_buf, bytes, buf)) ret = -EFAULT; } } @@ -1260,7 +1261,7 @@ static const struct snd_soc_component_driver lpass_component_driver = { .pcm_construct = lpass_platform_pcm_new, .suspend = lpass_platform_pcmops_suspend, .resume = lpass_platform_pcmops_resume, - .copy_user = lpass_platform_copy, + .copy = lpass_platform_copy, }; -- 2.35.3