From patchwork Wed May 24 00:52:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 9744833 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ED06C6032B for ; Wed, 24 May 2017 00:53:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDF4A2855A for ; Wed, 24 May 2017 00:53:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CED2A2872A; Wed, 24 May 2017 00:53:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33F1D2877E for ; Wed, 24 May 2017 00:53:12 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3528F2671BA; Wed, 24 May 2017 02:53:09 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E0F8D2671BD; Wed, 24 May 2017 02:53:06 +0200 (CEST) Received: from smtp-proxy004.phy.lolipop.jp (smtp-proxy004.phy.lolipop.jp [157.7.104.45]) by alsa0.perex.cz (Postfix) with ESMTP id 5F4E4267111 for ; Wed, 24 May 2017 02:53:01 +0200 (CEST) Received: from smtp-proxy004.phy.lolipop.lan (HELO smtp-proxy004.phy.lolipop.jp) (172.19.44.45) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp-proxy004.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Wed, 24 May 2017 09:52:59 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp-proxy004.phy.lolipop.jp (LOLIPOP-Fsecure); Wed, 24 May 2017 09:52:55 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: tiwai@suse.de Date: Wed, 24 May 2017 09:52:45 +0900 Message-Id: <20170524005255.31223-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170524005255.31223-1-o-takashi@sakamocchi.jp> References: <20170524005255.31223-1-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH RFC 01/11] ALSA: pcm: introduce an alias of prototype to copy PCM frames X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Usage of the same function prototype between core and driver implementation dedicates code lucidity. Especially, in a view of device driver developers, if core implementation includes functions with the prototype, it's good examples. In current design of ALSA PCM core, when devices doesn't use DMA between kernel space and device memory or platforms don't have good cache coherent protocol, then drivers need to have own implementation for data transmittion, without existent implementation inner ALSA PCM core. However, for this purpose, ALSA PCM core includes inefficient implementation. Additionally, in a point to which I addressed, it includes complicated codes. This commit introduces 'snd_pcm_copy_frames_t' to produce unified interface for the devices and core implementations. Signed-off-by: Takashi Sakamoto --- include/sound/pcm.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/sound/pcm.h b/include/sound/pcm.h index c609b891c4c2..6cb8df081787 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -63,6 +63,10 @@ struct snd_pcm_substream; struct snd_pcm_audio_tstamp_config; /* definitions further down */ struct snd_pcm_audio_tstamp_report; +typedef int (*snd_pcm_copy_frames_t)(struct snd_pcm_substream *substream, + unsigned int hwoff, unsigned int long data, + unsigned int off, snd_pcm_uframes_t count); + struct snd_pcm_ops { int (*open)(struct snd_pcm_substream *substream); int (*close)(struct snd_pcm_substream *substream);