From patchwork Thu Nov 24 01:33:52 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: 9444685 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 2AFCC60778 for ; Thu, 24 Nov 2016 01:47:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EC4327569 for ; Thu, 24 Nov 2016 01:47:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F6B627C2D; Thu, 24 Nov 2016 01:47:01 +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 50FA827569 for ; Thu, 24 Nov 2016 01:46:59 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id CF673266FEC; Thu, 24 Nov 2016 02:46:57 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 89D1C266FEE; Thu, 24 Nov 2016 02:44:39 +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 9DE6C266F8A; Thu, 24 Nov 2016 02:31:59 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id CF1C02666A8 for ; Thu, 24 Nov 2016 02:31:53 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 23 Nov 2016 17:31:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,689,1473145200"; d="scan'208";a="195095602" Received: from amanda-haswell-pc.sh.intel.com ([10.239.159.21]) by fmsmga004.fm.intel.com with ESMTP; 23 Nov 2016 17:31:51 -0800 From: mengdong.lin@linux.intel.com To: alsa-devel@alsa-project.org Date: Thu, 24 Nov 2016 09:33:52 +0800 Message-Id: <1479951232-23213-1-git-send-email-mengdong.lin@linux.intel.com> X-Mailer: git-send-email 2.5.0 Cc: tiwai@suse.de, liam.r.girdwood@linux.intel.com, Mengdong Lin , mengdong.lin@intel.com Subject: [alsa-devel] [PATCH 1/2] topology: Merge private data before embedded controls of a widget 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 For a widget ABI object, its private data sits before the embedded controls, so we should merge the private data blocks at first, and then the embedded controls. Signed-off-by: Mengdong Lin Acked-by: Liam Girdwood diff --git a/src/topology/dapm.c b/src/topology/dapm.c index 9fa0aac..e830751 100644 --- a/src/topology/dapm.c +++ b/src/topology/dapm.c @@ -160,7 +160,21 @@ static int tplg_build_widget(snd_tplg_t *tplg, base = &elem->ref_list; - /* for each ref in this control elem */ + /* A widget's private data sits before the embedded controls. + * So merge the private data blocks at first + */ + list_for_each(pos, base) { + ref = list_entry(pos, struct tplg_ref, list); + + if (ref->type != SND_TPLG_TYPE_DATA) + continue; + + err = tplg_copy_data(tplg, elem, ref); + if (err < 0) + return err; + } + + /* Merge the embedded controls */ list_for_each(pos, base) { ref = list_entry(pos, struct tplg_ref, list); @@ -190,12 +204,6 @@ static int tplg_build_widget(snd_tplg_t *tplg, err = copy_dapm_control(elem, ref->elem); break; - case SND_TPLG_TYPE_DATA: - err = tplg_copy_data(tplg, elem, ref); - if (err < 0) - return err; - break; - default: break; }