Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2561263rdg; Mon, 14 Aug 2023 06:35:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9P0wCiEvcyDprmG98ZWqtY5nUrzX8YwIFIYHPcS03wAE8c4FEff4+8gvKPOcf+Zz+Fc8f X-Received: by 2002:a05:6a00:14d4:b0:687:4369:4ad2 with SMTP id w20-20020a056a0014d400b0068743694ad2mr11064658pfu.33.1692020105405; Mon, 14 Aug 2023 06:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692020105; cv=none; d=google.com; s=arc-20160816; b=nsswRPtAl2jH96z8mNze4pbx+Hs9h0GNxSmuo3lGu+1LxCPZU4I4fPIVC3ZWnNXdqG 714XHwGm1BgyT0zYf1+vh+FNeVH6XKPKKwB7WPn5mXMa7l5Cv2f8F9AzmQWKMl9bgFxN cHxclZwD7CwgJNk/3HvQZ3fwJf9rDDmUEdvZekSkawpcWFvYUQwNSMPLeW5dWgeWzBpL DlH84WSEGJPDYBmkMJIk6o6VW5cPxEwJ+2qph4IAP5kHKawu6aphv4Ou3oWvgevhZmLz vhgFkeRPwabKuJO72iEakA58VhRO1H7X4cyuYwiSN+ie5kAn/bMRTWbT8J8d49w6Gmss WXOw== 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=n808a4+xHQ7QkYnImdaOPO/XS9ZeoOuNos6MXCLoDQg=; fh=3QC7G8VAS9bzcwDUoKp7h1N/2P/zJvj3xRB3T1528BI=; b=MBE2WcLBLOqnX122oT4ursGaZlsy78FpWOiEAegU91sIjZ7OdFJsAfjRYXNG/fmCZi GJ4JkHUW1AkO7OjkJYJG7SNYf2QSdkZEdZfIjrZtnDi9PSfGsSRG4xD+/IG6lopzEa2V kKDAzl2tcrPIutWDqPCPf/Ff04tHYnwJTerJnkZvDfNP8+7upZkxGAeKtmSgNMKYiuEG 1PMJYXRBraZI4FMnHkcYmTnZTvYYRSquN4dqWeyTq2M5/w2DkrbBK8o+UFZk4yO82x34 i1g6+vGNkYtKhQs5v1MkEFx9naukYNsI5WsQhEKV5t64Op1iFTT8FbCSnQstGynP4Tvn +tPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=f4jVwNPq; 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 cm10-20020a056a00338a00b0067c03d5624csi8107327pfb.293.2023.08.14.06.34.52; Mon, 14 Aug 2023 06:35:05 -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=f4jVwNPq; 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 S232370AbjHNL5a (ORCPT + 99 others); Mon, 14 Aug 2023 07:57:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233075AbjHNL4s (ORCPT ); Mon, 14 Aug 2023 07:56:48 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21D0A1702 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 16CF521992; Mon, 14 Aug 2023 11:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1692014156; 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=n808a4+xHQ7QkYnImdaOPO/XS9ZeoOuNos6MXCLoDQg=; b=f4jVwNPqaSekTafzEYgKqT65O+6RetjgJUK/t8pTxehTDjvAouzBbiJcJjqEcoED79mdMA oPPqjmJuZYuvz09pH2JVIII5OyA2nDVAInDLMqj6FMD3+ncErg3MaNog3mNmQUN25ImbXB eCmbUlx6HL1rEe7CyK2xfYtuPXvD6jA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1692014156; 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=n808a4+xHQ7QkYnImdaOPO/XS9ZeoOuNos6MXCLoDQg=; b=TYKQwET7QkFMKpdj3Q/o4fIEg9X3IfQ0X/VNEY/WWBVS1u1t4ymCNdD83xPQqYdgLerIrj iJaYIGpiJDfvHGAQ== 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 D2EDC138EE; Mon, 14 Aug 2023 11:55:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cJaeMksW2mRnMAAAMHmgww (envelope-from ); Mon, 14 Aug 2023 11:55:55 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Takashi Iwai , Lars-Peter Clausen , Claudiu Beznea , Mark Brown , Olivier Moysan , Arnaud Pouliquen Subject: [PATCH 22/25] ASoC: dmaengine: Use iov_iter for process callback, too Date: Mon, 14 Aug 2023 13:55:20 +0200 Message-Id: <20230814115523.15279-23-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=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 Along with the conversion to PCM copy ops, use the iov_iter for the pointer to be passed to the dmaengine process callback, too. It avoids the direct reference of iter_iov_addr(), and it can potentially help for the drivers to access memory properly (although both atmel and stm drivers don't use the given buffer address at all for now). Cc: Lars-Peter Clausen Cc: Claudiu Beznea Cc: Mark Brown Cc: Olivier Moysan Cc: Arnaud Pouliquen Signed-off-by: Takashi Iwai --- include/sound/dmaengine_pcm.h | 2 +- sound/soc/atmel/mchp-pdmc.c | 2 +- sound/soc/soc-generic-dmaengine-pcm.c | 5 ++--- sound/soc/stm/stm32_sai_sub.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index 2df54cf02cb3..c9a8bce9a785 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h @@ -142,7 +142,7 @@ struct snd_dmaengine_pcm_config { struct snd_pcm_substream *substream); int (*process)(struct snd_pcm_substream *substream, int channel, unsigned long hwoff, - void *buf, unsigned long bytes); + struct iov_iter *buf, unsigned long bytes); dma_filter_fn compat_filter_fn; struct device *dma_dev; const char *chan_names[SNDRV_PCM_STREAM_LAST + 1]; diff --git a/sound/soc/atmel/mchp-pdmc.c b/sound/soc/atmel/mchp-pdmc.c index c79c73e6791e..b3afcf25b4a9 100644 --- a/sound/soc/atmel/mchp-pdmc.c +++ b/sound/soc/atmel/mchp-pdmc.c @@ -962,7 +962,7 @@ static int mchp_pdmc_dt_init(struct mchp_pdmc *dd) /* used to clean the channel index found on RHR's MSB */ static int mchp_pdmc_process(struct snd_pcm_substream *substream, int channel, unsigned long hwoff, - void *buf, unsigned long bytes) + struct iov_iter *buf, unsigned long bytes) { struct snd_pcm_runtime *runtime = substream->runtime; u8 *dma_ptr = runtime->dma_area + hwoff + diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 1a4f000fddb9..6dee033ab9b9 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -296,18 +296,17 @@ static int dmaengine_copy(struct snd_soc_component *component, struct dmaengine_pcm *pcm = soc_component_to_pcm(component); int (*process)(struct snd_pcm_substream *substream, int channel, unsigned long hwoff, - void *buf, unsigned long bytes) = pcm->config->process; + struct iov_iter *buf, unsigned long bytes) = pcm->config->process; bool is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; void *dma_ptr = runtime->dma_area + hwoff + channel * (runtime->dma_bytes / runtime->channels); - void *ptr = (void __force *)iter_iov_addr(buf); if (is_playback) if (!copy_from_iter(dma_ptr, bytes, buf)) return -EFAULT; if (process) { - int ret = process(substream, channel, hwoff, ptr, bytes); + int ret = process(substream, channel, hwoff, buf, bytes); if (ret < 0) return ret; } diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c index 271ec5b3378d..39f9b4654fa2 100644 --- a/sound/soc/stm/stm32_sai_sub.c +++ b/sound/soc/stm/stm32_sai_sub.c @@ -1233,7 +1233,7 @@ static const struct snd_soc_dai_ops stm32_sai_pcm_dai_ops = { static int stm32_sai_pcm_process_spdif(struct snd_pcm_substream *substream, int channel, unsigned long hwoff, - void *buf, unsigned long bytes) + struct iov_iter *buf, unsigned long bytes) { struct snd_pcm_runtime *runtime = substream->runtime; struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); -- 2.35.3