From patchwork Fri Aug 7 15:39:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liam Girdwood X-Patchwork-Id: 6970481 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EFD169F39D for ; Fri, 7 Aug 2015 15:40:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1738F205E4 for ; Fri, 7 Aug 2015 15:40:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D5077205D4 for ; Fri, 7 Aug 2015 15:40:14 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id EDBDB261AE7; Fri, 7 Aug 2015 17:40:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 051DC2610A6; Fri, 7 Aug 2015 17:39:46 +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 283AB260631; Fri, 7 Aug 2015 17:39:44 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by alsa0.perex.cz (Postfix) with ESMTP id C074C260560 for ; Fri, 7 Aug 2015 17:39:36 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 07 Aug 2015 08:39:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,630,1432623600"; d="scan'208";a="778944399" Received: from euzan-mobl3.ger.corp.intel.com (HELO loki.ger.corp.intel.com) ([10.252.23.54]) by fmsmga002.fm.intel.com with ESMTP; 07 Aug 2015 08:39:30 -0700 From: Liam Girdwood To: Date: Fri, 7 Aug 2015 16:39:15 +0100 Message-Id: <1438961956-6239-1-git-send-email-liam.r.girdwood@linux.intel.com> X-Mailer: git-send-email 1.9.1 Cc: Takashi Iwai , Mengdong Lin , Mark Brown , Liam Girdwood Subject: [alsa-devel] [PATCH] topology: treat all DAPM controls types the same when copying 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 Copy all DAPM controls types using the same method. Signed-off-by: Mengdong Lin Signed-off-by: Liam Girdwood --- src/topology/dapm.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/topology/dapm.c b/src/topology/dapm.c index 7e26ea0..a0a8b86 100644 --- a/src/topology/dapm.c +++ b/src/topology/dapm.c @@ -107,8 +107,6 @@ static int tplg_parse_dapm_enums(snd_config_t *cfg, struct tplg_elem *elem) static int copy_dapm_control(struct tplg_elem *elem, struct tplg_elem *ref) { struct snd_soc_tplg_dapm_widget *widget = elem->widget; - struct snd_soc_tplg_mixer_control *mixer_ctrl = ref->mixer_ctrl; - struct snd_soc_tplg_enum_control *enum_ctrl = ref->enum_ctrl; tplg_dbg("Control '%s' used by '%s'\n", ref->id, elem->id); tplg_dbg("\tparent size: %d + %d -> %d, priv size -> %d\n", @@ -121,13 +119,10 @@ static int copy_dapm_control(struct tplg_elem *elem, struct tplg_elem *ref) elem->widget = widget; - /* copy new widget at the end */ - if (ref->type == OBJECT_TYPE_MIXER) - memcpy((void*)widget + elem->size, mixer_ctrl, ref->size); - else if (ref->type == OBJECT_TYPE_ENUM) - memcpy((void*)widget + elem->size, enum_ctrl, ref->size); - + /* append the control to the end of the widget */ + memcpy((void*)widget + elem->size, ref->obj, ref->size); elem->size += ref->size; + widget->num_kcontrols++; ref->compound_elem = 1; return 0;