From patchwork Thu Oct 27 07:13:21 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: 9399231 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 08A4060231 for ; Thu, 27 Oct 2016 11:45:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8D932A19E for ; Thu, 27 Oct 2016 11:45:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDB002A1A1; Thu, 27 Oct 2016 11:45:18 +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 931632A19E for ; Thu, 27 Oct 2016 11:45:17 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id BBAB82673C4; Thu, 27 Oct 2016 13:45:15 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3CAAB26739C; Thu, 27 Oct 2016 13:42:50 +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 9D0F026733B; Thu, 27 Oct 2016 09:12:19 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by alsa0.perex.cz (Postfix) with ESMTP id DC5702672C7 for ; Thu, 27 Oct 2016 09:12:13 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP; 27 Oct 2016 00:12:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.31,404,1473145200"; d="scan'208"; a="1050956822" Received: from amanda-haswell-pc.sh.intel.com ([10.239.159.21]) by orsmga001.jf.intel.com with ESMTP; 27 Oct 2016 00:12:10 -0700 From: mengdong.lin@linux.intel.com To: alsa-devel@alsa-project.org Date: Thu, 27 Oct 2016 15:13:21 +0800 Message-Id: <3784a595dba646244bbcb134ff039108763c0709.1477549962.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 11/22] topology: Rename varaibles for add physical links by C API 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. When adding a physical link element from C API: - Rename "link" to "link_tpl" for physical link config template for C API users. - Rename "lk" to "link" for physical link elements created by topology internally. Signed-off-by: Mengdong Lin diff --git a/src/topology/pcm.c b/src/topology/pcm.c index 08f2ca8..3fe77aa 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -758,10 +758,11 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) return 0; } +/* Add a physical DAI link element from C API */ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) { - struct snd_tplg_link_template *link = t->link; - struct snd_soc_tplg_link_config *lk; + struct snd_tplg_link_template *link_tpl = t->link; + struct snd_soc_tplg_link_config *link, *_link; struct tplg_elem *elem; int i; @@ -769,22 +770,25 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) return -EINVAL; /* here type can be either BE or CC. */ - elem = tplg_elem_new_common(tplg, NULL, link->name, t->type); + elem = tplg_elem_new_common(tplg, NULL, link_tpl->name, t->type); if (!elem) return -ENOMEM; if (t->type == SND_TPLG_TYPE_BE) - tplg_dbg("BE Link: %s", link->name); + tplg_dbg("BE Link: %s", link_tpl->name); else - tplg_dbg("CC Link: %s", link->name); + tplg_dbg("CC Link: %s", link_tpl->name); - lk = elem->link; - lk->size = elem->size; - lk->id = link->id; - lk->num_streams = link->num_streams; + link = elem->link; + link->size = elem->size; + link->id = link_tpl->id; + /* stream configs */ + if (link_tpl->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) + return -EINVAL; + link->num_streams = link_tpl->num_streams; for (i = 0; i < link->num_streams; i++) - tplg_add_stream_object(&lk->stream[i], &link->stream[i]); + tplg_add_stream_object(&link->stream[i], &link_tpl->stream[i]); return 0; }