From patchwork Sun Nov 6 05:11:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mengdong.lin@linux.intel.com X-Patchwork-Id: 9413853 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 9567A6022E for ; Sun, 6 Nov 2016 05:45:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 701C929291 for ; Sun, 6 Nov 2016 05:45:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60B6D2928A; Sun, 6 Nov 2016 05:45:40 +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 905B52928A for ; Sun, 6 Nov 2016 05:45:39 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1A486266C4E; Sun, 6 Nov 2016 06:45:38 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5467C266632; Sun, 6 Nov 2016 06:43:19 +0100 (CET) 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 9D6322665B6; Sun, 6 Nov 2016 06:10:28 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by alsa0.perex.cz (Postfix) with ESMTP id E61E9265B04 for ; Sun, 6 Nov 2016 06:10:20 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP; 05 Nov 2016 22:10:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,599,1473145200"; d="scan'208";a="28297981" Received: from amanda-haswell-pc.sh.intel.com ([10.239.159.21]) by orsmga004.jf.intel.com with ESMTP; 05 Nov 2016 22:10:16 -0700 From: mengdong.lin@linux.intel.com To: alsa-devel@alsa-project.org Date: Sun, 6 Nov 2016 13:11:49 +0800 Message-Id: <9b5fe3318b561348301acc9af4b7a7290dd041e2.1478407716.git.mengdong.lin@linux.intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: References: Cc: Mengdong Lin , tiwai@suse.de, hardik.t.shah@intel.com, guneshwor.o.singh@intel.com, liam.r.girdwood@linux.intel.com, vinod.koul@intel.com, broonie@kernel.org, mengdong.lin@intel.com Subject: [alsa-devel] [PATCH 02/13] topology: Merge an element's be & cc pointer to one link pointer 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 From: Mengdong Lin Code refactoring. Previously an element has two pointers, 'be' and 'cc', for BE (Back End) and CC (Codec-Codec) link respectively. But actually the topology tool processes BE and CC links in the same way, so these two pointers can be merged into one 'link' pointer, which can be used configure any physical links. Signed-off-by: Mengdong Lin diff --git a/src/topology/pcm.c b/src/topology/pcm.c index b7a2df7..64fd78f 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -175,11 +175,7 @@ int tplg_build_link_cfg(snd_tplg_t *tplg, unsigned int type) return -EINVAL; } - if (type == SND_TPLG_TYPE_BE) - link = elem->be; - else - link = elem->cc; - + link = elem->link; err = tplg_build_stream_cfg(tplg, link->stream, link->num_streams); if (err < 0) @@ -528,7 +524,7 @@ int tplg_parse_be(snd_tplg_t *tplg, if (!elem) return -ENOMEM; - link = elem->be; + link = elem->link; link->size = elem->size; tplg_dbg(" BE: %s\n", elem->id); @@ -588,7 +584,7 @@ int tplg_parse_cc(snd_tplg_t *tplg, if (!elem) return -ENOMEM; - link = elem->cc; + link = elem->link; link->size = elem->size; tplg_dbg(" CC: %s\n", elem->id); @@ -742,14 +738,12 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) if (!elem) return -ENOMEM; - if (t->type == SND_TPLG_TYPE_BE) { + if (t->type == SND_TPLG_TYPE_BE) tplg_dbg("BE Link: %s", link->name); - lk = elem->be; - } else { + else tplg_dbg("CC Link: %s", link->name); - lk = elem->cc; - } + lk = elem->link; lk->size = elem->size; lk->id = link->id; lk->num_streams = link->num_streams; diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h index 7b30b84..3aa51ee 100644 --- a/src/topology/tplg_local.h +++ b/src/topology/tplg_local.h @@ -144,8 +144,7 @@ struct tplg_elem { struct snd_soc_tplg_bytes_control *bytes_ext; struct snd_soc_tplg_dapm_widget *widget; struct snd_soc_tplg_pcm *pcm; - struct snd_soc_tplg_link_config *be; - struct snd_soc_tplg_link_config *cc; + struct snd_soc_tplg_link_config *link;/* physical link */ struct snd_soc_tplg_dapm_graph_elem *route; struct snd_soc_tplg_stream *stream_cfg; struct snd_soc_tplg_stream_caps *stream_caps;