- Upstream fixes, including the alsa-tools build breakage: 0001-ucm-Use-strncmp-to-avoid-access-out-of-boundary.patch 0002-ucm-return-always-at-least-NULL-if-no-list-is-availa.patch 0003-ucm-add-_identifiers-list.patch 0004-namehint-correct-the-args-check.patch 0005-namehint-improve-the-previous-patch-check-the-return.patch 0006-ucm-docs-allow-spaces-in-device-names-for-JackHWMute.patch 0007-use-case-docs-add-PlaybackMixerCopy-and-CaptureMixer.patch 0008-ucm-docs-add-JackCTL-rearrange-JackControl-and-JackD.patch 0009-ucm-Do-not-fail-to-parse-configs-on-cards-with-an-em.patch 0010-src-ucm-main.c-fix-build-without-mixer.patch 0011-alsa.m4-another-try-to-fix-the-libatopology-detectio.patch 0012-ucm-docs-add-Mic-DigitalMic-and-multiple-devices-com.patch 0013-ucm-docs-remove-DigitalMic-it-does-not-have-sense.patch 0014-ucm-docs-change-the-Mic-description-to-simple-Microp.patch 0015-ucm-docs-add-note-about-the-sequences-and-device-spl.patch 0016-ucm-docs-remove-MixerCopy-values-add-Priority-for-ve.patch 0017-ucm-setup-conf_format-after-getting-ALSA_CONFIG_UCM_.patch 0018-alsa-lib-fix-the-array-parser-unique-compound-keys.patch 0019-topology-remove-vendor_fd-name-from-snd_tplg-structu.patch 0020-topology-file-position-and-size-cleanups.patch 0021-topology-use-an-array-describing-blocks-for-the-main.patch 0022-topology-use-size_t-for-calc_block_size.patch 0023-topology-merge-write_block-to-tplg_write_data.patch 0024-topology-make-vebose-output-more-nice.patch 0025-topology-use-list_insert-macro-in-tplg_elem_insert.patch 0026-topology-dapm-coding-fixes.patch 0027-topology-dapm-merge-identical-index-blocks-like-for-.patch 0028-topology-more-coding-fixes.patch 0029-Fix-alsa-sound-.h-for-external-programs.patch OBS-URL: https://build.opensuse.org/request/show/758564 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=263
180 lines
4.2 KiB
Diff
180 lines
4.2 KiB
Diff
From 012bd3b28c0d2744db482caca630d5b0a19e4dab Mon Sep 17 00:00:00 2001
|
|
From: Jaroslav Kysela <perex@perex.cz>
|
|
Date: Fri, 13 Dec 2019 18:24:55 +0100
|
|
Subject: [PATCH 21/30] topology: use an array describing blocks for the main
|
|
build loop
|
|
|
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
---
|
|
src/topology/builder.c | 146 +++++++++++++++++++++++--------------------------
|
|
1 file changed, 67 insertions(+), 79 deletions(-)
|
|
|
|
diff --git a/src/topology/builder.c b/src/topology/builder.c
|
|
index 4e6cbbb08a1a..ec1af42ddf9b 100644
|
|
--- a/src/topology/builder.c
|
|
+++ b/src/topology/builder.c
|
|
@@ -258,93 +258,81 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg)
|
|
|
|
int tplg_write_data(snd_tplg_t *tplg)
|
|
{
|
|
+ struct wtable {
|
|
+ const char *name;
|
|
+ struct list_head *list;
|
|
+ int type;
|
|
+ } *wptr, wtable[] = {
|
|
+ {
|
|
+ .name = "control mixer elements",
|
|
+ .list = &tplg->mixer_list,
|
|
+ .type = SND_TPLG_TYPE_MIXER,
|
|
+ },
|
|
+ {
|
|
+ .name = "control enum elements",
|
|
+ .list = &tplg->enum_list,
|
|
+ .type = SND_TPLG_TYPE_ENUM,
|
|
+ },
|
|
+ {
|
|
+ .name = "control extended (bytes) elements",
|
|
+ .list = &tplg->bytes_ext_list,
|
|
+ .type = SND_TPLG_TYPE_BYTES,
|
|
+ },
|
|
+ {
|
|
+ .name = "dapm widget elements",
|
|
+ .list = &tplg->widget_list,
|
|
+ .type = SND_TPLG_TYPE_DAPM_WIDGET,
|
|
+ },
|
|
+ {
|
|
+ .name = "pcm elements",
|
|
+ .list = &tplg->pcm_list,
|
|
+ .type = SND_TPLG_TYPE_PCM,
|
|
+ },
|
|
+ {
|
|
+ .name = "physical dai elements",
|
|
+ .list = &tplg->dai_list,
|
|
+ .type = SND_TPLG_TYPE_DAI,
|
|
+ },
|
|
+ {
|
|
+ .name = "be elements",
|
|
+ .list = &tplg->be_list,
|
|
+ .type = SND_TPLG_TYPE_BE,
|
|
+ },
|
|
+ {
|
|
+ .name = "cc elements",
|
|
+ .list = &tplg->cc_list,
|
|
+ .type = SND_TPLG_TYPE_CC,
|
|
+ },
|
|
+ {
|
|
+ .name = "route (dapm graph) elements",
|
|
+ .list = &tplg->route_list,
|
|
+ .type = SND_TPLG_TYPE_DAPM_GRAPH,
|
|
+ },
|
|
+ {
|
|
+ .name = "private data elements",
|
|
+ .list = &tplg->pdata_list,
|
|
+ .type = SND_TPLG_TYPE_DATA,
|
|
+ },
|
|
+ };
|
|
+
|
|
ssize_t ret;
|
|
+ unsigned int index;
|
|
|
|
/* write manifest */
|
|
ret = write_manifest_data(tplg);
|
|
if (ret < 0) {
|
|
- SNDERR("failed to write manifest %zd\n", ret);
|
|
- return ret;
|
|
- }
|
|
-
|
|
- /* write mixer elems. */
|
|
- ret = write_block(tplg, &tplg->mixer_list,
|
|
- SND_TPLG_TYPE_MIXER);
|
|
- if (ret < 0) {
|
|
- SNDERR("failed to write control elems %zd\n", ret);
|
|
- return ret;
|
|
- }
|
|
-
|
|
- /* write enum control elems. */
|
|
- ret = write_block(tplg, &tplg->enum_list,
|
|
- SND_TPLG_TYPE_ENUM);
|
|
- if (ret < 0) {
|
|
- SNDERR("failed to write control elems %zd\n", ret);
|
|
- return ret;
|
|
- }
|
|
-
|
|
- /* write bytes extended control elems. */
|
|
- ret = write_block(tplg, &tplg->bytes_ext_list,
|
|
- SND_TPLG_TYPE_BYTES);
|
|
- if (ret < 0) {
|
|
- SNDERR("failed to write control elems %zd\n", ret);
|
|
- return ret;
|
|
- }
|
|
-
|
|
- /* write widget elems */
|
|
- ret = write_block(tplg, &tplg->widget_list,
|
|
- SND_TPLG_TYPE_DAPM_WIDGET);
|
|
- if (ret < 0) {
|
|
- SNDERR("failed to write widget elems %zd\n", ret);
|
|
- return ret;
|
|
- }
|
|
-
|
|
- /* write pcm elems */
|
|
- ret = write_block(tplg, &tplg->pcm_list,
|
|
- SND_TPLG_TYPE_PCM);
|
|
- if (ret < 0) {
|
|
- SNDERR("failed to write pcm elems %zd\n", ret);
|
|
- return ret;
|
|
- }
|
|
-
|
|
- /* write physical dai elems */
|
|
- ret = write_block(tplg, &tplg->dai_list,
|
|
- SND_TPLG_TYPE_DAI);
|
|
- if (ret < 0) {
|
|
- SNDERR("failed to write physical dai elems %zd\n", ret);
|
|
- return ret;
|
|
- }
|
|
-
|
|
- /* write be elems */
|
|
- ret = write_block(tplg, &tplg->be_list,
|
|
- SND_TPLG_TYPE_BE);
|
|
- if (ret < 0) {
|
|
- SNDERR("failed to write be elems %zd\n", ret);
|
|
- return ret;
|
|
- }
|
|
-
|
|
- /* write cc elems */
|
|
- ret = write_block(tplg, &tplg->cc_list,
|
|
- SND_TPLG_TYPE_CC);
|
|
- if (ret < 0) {
|
|
- SNDERR("failed to write cc elems %zd\n", ret);
|
|
- return ret;
|
|
- }
|
|
-
|
|
- /* write route elems */
|
|
- ret = write_block(tplg, &tplg->route_list,
|
|
- SND_TPLG_TYPE_DAPM_GRAPH);
|
|
- if (ret < 0) {
|
|
- SNDERR("failed to write graph elems %zd\n", ret);
|
|
+ SNDERR("failed to write manifest %d\n", ret);
|
|
return ret;
|
|
}
|
|
|
|
- /* write private data */
|
|
- ret = write_block(tplg, &tplg->pdata_list,
|
|
- SND_TPLG_TYPE_DATA);
|
|
- if (ret < 0) {
|
|
- SNDERR("failed to write private data %zd\n", ret);
|
|
- return ret;
|
|
+ /* write all blocks */
|
|
+ for (index = 0; index < ARRAY_SIZE(wtable); index++) {
|
|
+ wptr = &wtable[index];
|
|
+ ret = write_block(tplg, wptr->list, wptr->type);
|
|
+ if (ret < 0) {
|
|
+ SNDERR("failed to write %s: %s\n", wptr->name, snd_strerror(-ret));
|
|
+ return ret;
|
|
+ }
|
|
}
|
|
|
|
return 0;
|
|
--
|
|
2.16.4
|
|
|