alsa/0027-topology-dapm-merge-identical-index-blocks-like-for-.patch
Takashi Iwai 1848bd6c60 Accepting request 758564 from home:tiwai:branches:multimedia:libs
- 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
2019-12-20 16:28:33 +00:00

104 lines
3.5 KiB
Diff

From 2b50b594dcbf69f8dcc6e8cf673748f7063c3c17 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 13 Dec 2019 21:56:58 +0100
Subject: [PATCH 27/30] topology: dapm - merge identical index blocks like for
other elems
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/topology/dapm.c | 14 +++++++-------
src/topology/elem.c | 2 +-
src/topology/tplg_local.h | 1 +
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/topology/dapm.c b/src/topology/dapm.c
index cd80a4c03d92..ce46913192df 100644
--- a/src/topology/dapm.c
+++ b/src/topology/dapm.c
@@ -313,7 +313,7 @@ int tplg_build_routes(snd_tplg_t *tplg)
return 0;
}
-struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg)
+struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg, int index)
{
struct tplg_elem *elem;
struct snd_soc_tplg_dapm_graph_elem *line;
@@ -322,7 +322,8 @@ struct tplg_elem *tplg_elem_new_route(snd_tplg_t *tplg)
if (!elem)
return NULL;
- list_add_tail(&elem->list, &tplg->route_list);
+ elem->index = index;
+ tplg_elem_insert(elem, &tplg->route_list);
strcpy(elem->id, "line");
elem->type = SND_TPLG_TYPE_DAPM_GRAPH;
elem->size = sizeof(*line);
@@ -403,10 +404,9 @@ static int tplg_parse_routes(snd_tplg_t *tplg, snd_config_t *cfg, int index)
if (snd_config_get_string(n, &val) < 0)
continue;
- elem = tplg_elem_new_route(tplg);
+ elem = tplg_elem_new_route(tplg, index);
if (!elem)
return -ENOMEM;
- elem->index = index;
line = elem->route;
err = tplg_parse_line(val, line);
@@ -628,7 +628,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg,
return 0;
}
-int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t)
+int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t, int index)
{
struct tplg_elem *elem;
struct snd_soc_tplg_dapm_graph_elem *line;
@@ -636,7 +636,7 @@ int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t)
if (!t->src || !t->sink)
return -EINVAL;
- elem = tplg_elem_new_route(tplg);
+ elem = tplg_elem_new_route(tplg, index);
if (!elem)
return -ENOMEM;
@@ -656,7 +656,7 @@ int tplg_add_graph_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
int i, ret;
for (i = 0; i < gt->count; i++) {
- ret = tplg_add_route(tplg, gt->elem + i);
+ ret = tplg_add_route(tplg, gt->elem + i, t->index);
if (ret < 0)
return ret;
}
diff --git a/src/topology/elem.c b/src/topology/elem.c
index 2066fad83774..140cdd327994 100644
--- a/src/topology/elem.c
+++ b/src/topology/elem.c
@@ -132,7 +132,7 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id,
}
/* insert a new element into list in the ascending order of index value */
-static void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list)
+void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list)
{
struct list_head *pos, *p = &(elem_p->list);
struct tplg_elem *elem;
diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h
index 7b8abcdefbcf..11efce6d580c 100644
--- a/src/topology/tplg_local.h
+++ b/src/topology/tplg_local.h
@@ -273,6 +273,7 @@ int tplg_ref_add_elem(struct tplg_elem *elem, struct tplg_elem *elem_ref);
struct tplg_elem *tplg_elem_new(void);
void tplg_elem_free(struct tplg_elem *elem);
void tplg_elem_free_list(struct list_head *base);
+void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list);
struct tplg_elem *tplg_elem_lookup(struct list_head *base,
const char* id,
unsigned int type,
--
2.16.4