Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp666204rdb; Sat, 19 Aug 2023 19:27:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZQqWa5C5asg/Ktz1mSnwvPFptn1IGzrufFy60ckjxc+txYeJKYGLa3i/stOMTQSEEWC2s X-Received: by 2002:a05:6a20:938d:b0:13c:bda3:79c3 with SMTP id x13-20020a056a20938d00b0013cbda379c3mr4891491pzh.4.1692498460188; Sat, 19 Aug 2023 19:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692498460; cv=none; d=google.com; s=arc-20160816; b=sNMozAhfF5IGATHl+ltaxFJnJAKBBlVTcZTFQLFY0sihu6w9WS8lAG8Lqo8QI3abiC 1KJdFpkKnXQQC9mZJrRr4mr0SIC96N0EY3ZBTUQzNtxHRYCpXTTq60b28/QGRGACYi/W HXTYqKK19Ki2TZ6Ctt3LGxBeYEABNI3E04UjjNL219SqAeKV01lGyiGYIls5TgaEEaqI 2sOu5yqhy/M4+aM82ZceCyRBn1EESvrDcQRb7tduOQm/pApjAOT1QVtG00CBpqdnMhMM Dbm7qM2emwGSeI5RA3zMZIIMb5u4083A6FtXWyPA+SXgr21/KBSPwk0qExYOdyst6yBA WR3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=tq9PtUxRo5aCG7YmiF5XRotBelhhIJHHHiKUnefgEoo=; fh=/ZO1v/PXhTHSW+VxYl8kY/AYTo4Q9IaGhsqo3/w9vig=; b=riaD+8lCNwaUd4O+J62s3dpW7pI34Tjsl4McteoDPl13nS//k4LAZyYJaXnWgTqUou FlE8D+MH5zfhu+Ib6R3BxLSvKEZmkIQVynQjWczc8mirkBR0QgDoaP6jE/wKfTXyXvqU pWcEKD+VrrU61zp+Bufh2jIjtfgSiG5lmoDoIQSbwFZriMnBr0ejfc1WH/+wKefKAH1c al+Lz7AFsL+dSkN/uPdl+DN/n0GVEOd+x8p0s73n9EuniOpIjYbPOBgWWoh4q7uSc8DK s+7PEk06jDt8angQD94JDzFg53k5CM6b3NYFXWlGjWGUA/f4c0K2Zfm3TxsxyzknfQ69 J0GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cdtKUM81; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y3-20020a056a001c8300b0068a2f6b841esi1566045pfw.293.2023.08.19.19.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 19:27:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cdtKUM81; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E8CC41D43F0; Sat, 19 Aug 2023 11:23:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237387AbjHOOAc (ORCPT + 99 others); Tue, 15 Aug 2023 10:00:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237431AbjHOOAK (ORCPT ); Tue, 15 Aug 2023 10:00:10 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58A51D1 for ; Tue, 15 Aug 2023 07:00:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692108009; x=1723644009; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=jFg6+ygBgtTz0t27/ZViFNE4X16j6COx/+N58kJrkiA=; b=cdtKUM81Ma98OicPFrTe+S5DDGfdXttmEbyAQi1CiqR2o/Fn43rxIGYs KX5Ul1P2hkVC2Hf0oD/uhQD24wLaJREckUQPitAHbISoop9Yy1YFH1/MR 1QDkSr4sbXxVW64BrjJWiPNs+hidophjo01EJuzXwF3bAMj8E3x0URQgj 9qk4itiEK2UmdsiAPRrTg1yGk6n5LStiOgWKNkoQKRL0yu0YrIl8ecAuH JQWsghB5zwxBs6GRTYtt8IT+KpJFsJ5WL1/8NeNn3Wt7ZX2Z20GqVo20g eod0RJJBiWdgmuI8/zCxaWwNBBLaiEc1uEcy4iCurSr+7tUQEHe8NquZe A==; X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="375051125" X-IronPort-AV: E=Sophos;i="6.01,174,1684825200"; d="scan'208";a="375051125" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2023 07:00:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="683660812" X-IronPort-AV: E=Sophos;i="6.01,174,1684825200"; d="scan'208";a="683660812" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003.jf.intel.com with ESMTP; 15 Aug 2023 07:00:07 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qVuab-004EoF-2h; Tue, 15 Aug 2023 17:00:05 +0300 Date: Tue, 15 Aug 2023 17:00:05 +0300 From: Andy Shevchenko To: Takashi Iwai Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen , Mark Brown Subject: Re: [PATCH 21/25] ASoC: dmaengine: Convert to generic PCM copy ops Message-ID: References: <20230814115523.15279-1-tiwai@suse.de> <20230814115523.15279-22-tiwai@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230814115523.15279-22-tiwai@suse.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED 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 On Mon, Aug 14, 2023 at 01:55:19PM +0200, Takashi Iwai wrote: > This patch converts the ASoC dmaenging driver code to use the new > unified PCM copy callback. It's a straightforward conversion from > *_user() to *_iter() variants. > > The process callback is still using the direct pointer as of now, but > it'll be converted in the next patch. > > Note that copy_from/to_iter() returns the copied bytes, hence the > error condition is inverted from copy_from/to_user(). ... > if (is_playback) > - if (copy_from_user(dma_ptr, buf, bytes)) > + if (!copy_from_iter(dma_ptr, bytes, buf)) != bytes ? > return -EFAULT; Can be compressed to a single conditional: if (is_playback && copy_from_iter(dma_ptr, bytes, buf) != bytes) ... > if (!is_playback) > - if (copy_to_user(buf, dma_ptr, bytes)) > + if (!copy_to_iter(dma_ptr, bytes, buf)) > return -EFAULT; As per above. -- With Best Regards, Andy Shevchenko