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: Mengdong Lin <mengdong.lin@linux.intel.com>,
	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: [PATCH 4/6] topology: Define a function to build a single PCM element
Date: Fri,  4 Nov 2016 07:07:58 +0800	[thread overview]
Message-ID: <deb820d71984bd0fcd74c473581b7b59a2926f45.1478212626.git.mengdong.lin@linux.intel.com> (raw)
In-Reply-To: <cover.1478212626.git.mengdong.lin@linux.intel.com>

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

Code refactoring. Rename tplg_build_pcm() to tplg_build_pcms() to build
all PCM (FE DAI & DAI link) elements. It will call a new function
build_pcm() to build a single PCM elemement.

build_pcm() will be extended to handle more properties of a PCM.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>

diff --git a/src/topology/parser.c b/src/topology/parser.c
index 3ab64f4..7b2c879 100644
--- a/src/topology/parser.c
+++ b/src/topology/parser.c
@@ -267,7 +267,7 @@ static int tplg_build_integ(snd_tplg_t *tplg)
 	if (err <  0)
 		return err;
 
-	err = tplg_build_pcm(tplg, SND_TPLG_TYPE_PCM);
+	err = tplg_build_pcms(tplg, SND_TPLG_TYPE_PCM);
 	if (err <  0)
 		return err;
 
diff --git a/src/topology/pcm.c b/src/topology/pcm.c
index bd70dc9..77b7605 100644
--- a/src/topology/pcm.c
+++ b/src/topology/pcm.c
@@ -70,8 +70,20 @@ static int tplg_build_stream_caps(snd_tplg_t *tplg,
 	return 0;
 }
 
-/* build FE DAI/PCM configurations */
-int tplg_build_pcm(snd_tplg_t *tplg, unsigned int type)
+/* build a PCM (FE DAI & DAI link) element */
+static int build_pcm(snd_tplg_t *tplg, struct tplg_elem *elem)
+{
+	int err;
+
+	err = tplg_build_stream_caps(tplg, elem->id, elem->pcm->caps);
+		if (err < 0)
+			return err;
+
+	return 0;
+}
+
+/* build all PCM (FE DAI & DAI link) elements */
+int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type)
 {
 	struct list_head *base, *pos;
 	struct tplg_elem *elem;
@@ -86,7 +98,7 @@ int tplg_build_pcm(snd_tplg_t *tplg, unsigned int type)
 			return -EINVAL;
 		}
 
-		err = tplg_build_stream_caps(tplg, elem->id, elem->pcm->caps);
+		err = build_pcm(tplg, elem);
 		if (err < 0)
 			return err;
 
diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h
index cfde4cc..7b30b84 100644
--- a/src/topology/tplg_local.h
+++ b/src/topology/tplg_local.h
@@ -284,7 +284,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
 int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl,
 		   struct tplg_elem **e);
 
-int tplg_build_pcm(snd_tplg_t *tplg, unsigned int type);
+int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type);
 int tplg_build_link_cfg(snd_tplg_t *tplg, unsigned int type);
 int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
 int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
-- 
2.7.4

  parent reply	other threads:[~2016-11-03 23:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03 23:00 [PATCH 0/6] topology: Updates for PCM object in ABI v5 mengdong.lin
2016-11-03 23:05 ` [PATCH 1/6] topology: ABI - Update stream caps and PCM objects to " mengdong.lin
2016-11-03 23:06 ` [PATCH 2/6] topology: Parse sig_bits of stream caps mengdong.lin
2016-11-03 23:07 ` [PATCH 3/6] topology: Parse flags for PCM mengdong.lin
2016-11-05 15:45   ` Takashi Iwai
2016-11-05 16:54     ` Lin, Mengdong
2016-11-03 23:07 ` mengdong.lin [this message]
2016-11-03 23:08 ` [PATCH 5/6] topology: Parse and build private data " mengdong.lin
2016-11-03 23:08 ` [PATCH 6/6] topology: tplg_elem_lookup() checks parameter before searching mengdong.lin
2016-11-03 23:09 ` [PATCH 0/6] topology: Updates for PCM object in ABI v5 Lin, Mengdong
2016-11-05 15:45 ` 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=deb820d71984bd0fcd74c473581b7b59a2926f45.1478212626.git.mengdong.lin@linux.intel.com \
    --to=mengdong.lin@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=guneshwor.o.singh@intel.com \
    --cc=hardik.t.shah@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=mengdong.lin@intel.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.com \
    /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).