From patchwork Thu Apr 13 06:52:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fuweix.tang@intel.com X-Patchwork-Id: 9678777 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 57342601C3 for ; Thu, 13 Apr 2017 07:01:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48F412861E for ; Thu, 13 Apr 2017 07:01:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C48828632; Thu, 13 Apr 2017 07:01:20 +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 846EE28631 for ; Thu, 13 Apr 2017 07:01:19 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A0DDD26705D; Thu, 13 Apr 2017 08:53:10 +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 DA3D8267050; Thu, 13 Apr 2017 08:53:06 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by alsa0.perex.cz (Postfix) with ESMTP id E732D266AE4 for ; Thu, 13 Apr 2017 08:53:00 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2017 23:52:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,193,1488873600"; d="scan'208";a="73475717" Received: from tangfw-thinkpad-x230.sh.intel.com ([10.239.47.88]) by orsmga002.jf.intel.com with ESMTP; 12 Apr 2017 23:52:58 -0700 From: fuweix.tang@intel.com To: alsa-devel@alsa-project.org Date: Thu, 13 Apr 2017 14:52:45 +0800 Message-Id: <48a65d737ca229024dbb3d317e6a96f72263c917.1492065639.git.fuweix.tang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Cc: tiwai@suse.de, liam.r.girdwood@linux.intel.com, Fuwei Tang , mengdong.lin@intel.com Subject: [alsa-devel] [PATCH 2/4] topology: Remove code parsing index value in paring each object 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: Fuwei Tang We insert a new element into the object list based on its index value, so we parse index value in "tplg_elem_new_common" before insert it, and then remove code parsing index value in parsing each object. Signed-off-by: Fuwei Tang Reviewed-by: Mengdong Lin --- src/topology/ctl.c | 27 --------------------------- src/topology/dapm.c | 9 --------- src/topology/data.c | 9 --------- src/topology/pcm.c | 36 ------------------------------------ 4 files changed, 81 deletions(-) diff --git a/src/topology/ctl.c b/src/topology/ctl.c index 1da3d18..1b160a2 100644 --- a/src/topology/ctl.c +++ b/src/topology/ctl.c @@ -397,15 +397,6 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg, if (id[0] == '#') continue; - if (strcmp(id, "index") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - - elem->index = atoi(val); - tplg_dbg("\t%s: %d\n", id, elem->index); - continue; - } - if (strcmp(id, "base") == 0) { if (snd_config_get_string(n, &val) < 0) return -EINVAL; @@ -538,15 +529,6 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg, if (id[0] == '#') continue; - if (strcmp(id, "index") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - - elem->index = atoi(val); - tplg_dbg("\t%s: %d\n", id, elem->index); - continue; - } - if (strcmp(id, "texts") == 0) { if (snd_config_get_string(n, &val) < 0) return -EINVAL; @@ -648,15 +630,6 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg, if (id[0] == '#') continue; - if (strcmp(id, "index") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - - elem->index = atoi(val); - tplg_dbg("\t%s: %d\n", id, elem->index); - continue; - } - if (strcmp(id, "channel") == 0) { if (mc->num_channels >= SND_SOC_TPLG_MAX_CHAN) { SNDERR("error: too many channels %s\n", diff --git a/src/topology/dapm.c b/src/topology/dapm.c index eef72bb..ba5d9fe 100644 --- a/src/topology/dapm.c +++ b/src/topology/dapm.c @@ -483,15 +483,6 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, if (id[0] == '#') continue; - if (strcmp(id, "index") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - - elem->index = atoi(val); - tplg_dbg("\t%s: %d\n", id, elem->index); - continue; - } - if (strcmp(id, "type") == 0) { if (snd_config_get_string(n, &val) < 0) return -EINVAL; diff --git a/src/topology/data.c b/src/topology/data.c index e2aa38c..7b92cea 100644 --- a/src/topology/data.c +++ b/src/topology/data.c @@ -1009,15 +1009,6 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg, continue; } - if (strcmp(id, "index") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - - elem->index = atoi(val); - tplg_dbg("\t%s: %d\n", id, elem->index); - continue; - } - if (strcmp(id, "type") == 0) { if (snd_config_get_string(n, &val) < 0) return -EINVAL; diff --git a/src/topology/pcm.c b/src/topology/pcm.c index 5568d57..ed50c9c 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -554,15 +554,6 @@ int tplg_parse_pcm(snd_tplg_t *tplg, if (id[0] == '#') continue; - if (strcmp(id, "index") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - - elem->index = atoi(val); - tplg_dbg("\t%s: %d\n", id, elem->index); - continue; - } - if (strcmp(id, "id") == 0) { if (snd_config_get_string(n, &val) < 0) return -EINVAL; @@ -654,15 +645,6 @@ int tplg_parse_dai(snd_tplg_t *tplg, if (id[0] == '#') continue; - if (strcmp(id, "index") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - - elem->index = atoi(val); - tplg_dbg("\t%s: %d\n", id, elem->index); - continue; - } - if (strcmp(id, "id") == 0) { if (snd_config_get_string(n, &val) < 0) return -EINVAL; @@ -804,15 +786,6 @@ int tplg_parse_link(snd_tplg_t *tplg, if (id[0] == '#') continue; - if (strcmp(id, "index") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - - elem->index = atoi(val); - tplg_dbg("\t%s: %d\n", id, elem->index); - continue; - } - if (strcmp(id, "id") == 0) { if (snd_config_get_string(n, &val) < 0) return -EINVAL; @@ -918,15 +891,6 @@ int tplg_parse_cc(snd_tplg_t *tplg, if (id[0] == '#') continue; - if (strcmp(id, "index") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - - elem->index = atoi(val); - tplg_dbg("\t%s: %d\n", id, elem->index); - continue; - } - if (strcmp(id, "id") == 0) { if (snd_config_get_string(n, &val) < 0) return -EINVAL;