alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: mengdong.lin@linux.intel.com
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, liam.r.girdwood@linux.intel.com,
	Mengdong Lin <mengdong.lin@linux.intel.com>,
	mengdong.lin@intel.com
Subject: [PATCH 1/2] topology: Merge private data before embedded controls of a widget
Date: Thu, 24 Nov 2016 09:33:52 +0800	[thread overview]
Message-ID: <1479951232-23213-1-git-send-email-mengdong.lin@linux.intel.com> (raw)

From: Mengdong Lin <mengdong.lin@linux.intel.com>

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 <mengdong.lin@linux.intel.com>

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;
 		}
-- 
2.5.0

             reply	other threads:[~2016-11-24  1:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24  1:33 mengdong.lin [this message]
2016-11-24 12:09 ` [PATCH 1/2] topology: Merge private data before embedded controls of a widget Liam Girdwood
2016-11-24 13:25 ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479951232-23213-1-git-send-email-mengdong.lin@linux.intel.com \
    --to=mengdong.lin@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=mengdong.lin@intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).