From patchwork Thu Oct 27 07:12:14 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: 9399155 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 BC5F5600BA for ; Thu, 27 Oct 2016 10:36:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0D5B2A142 for ; Thu, 27 Oct 2016 10:36:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B59FA2A147; Thu, 27 Oct 2016 10:36:23 +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 C22E32A142 for ; Thu, 27 Oct 2016 10:36:18 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C9A1226651B; Thu, 27 Oct 2016 12:36:16 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 56F0B26738F; Thu, 27 Oct 2016 12:33:54 +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 8239C26731C; Thu, 27 Oct 2016 09:11:07 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by alsa0.perex.cz (Postfix) with ESMTP id A337226688A for ; Thu, 27 Oct 2016 09:11:01 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 27 Oct 2016 00:11:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.31,404,1473145200"; d="scan'208"; a="1076494246" Received: from amanda-haswell-pc.sh.intel.com ([10.239.159.21]) by fmsmga002.fm.intel.com with ESMTP; 27 Oct 2016 00:10:59 -0700 From: mengdong.lin@linux.intel.com To: alsa-devel@alsa-project.org Date: Thu, 27 Oct 2016 15:12:14 +0800 Message-Id: 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 07/22] 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 33940c6..64c8fd9 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) @@ -546,7 +542,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); @@ -606,7 +602,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); @@ -760,14 +756,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;