Skip to contentSkip to conversation

topology: treat all DAPM controls types the same when copying

PATCH Applied Liam Girdwood 2 participants 4 messages Aug 7, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 topology: treat all DAPM controls types the same when copying

From: Mengdong Lin <[email protected]>

Copy all DAPM controls types using the same method.

---
 src/topology/dapm.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
src/topology/dapm.c +3 -8
index 7e26ea0..a0a8b86 100644
@@ -107,8 +107,6 @@ static int tplg_parse_dapm_enums(snd_config_t *cfg, struct tplg_elem *elem)
 static int copy_dapm_control(struct tplg_elem *elem, struct tplg_elem *ref)
 {
 	struct snd_soc_tplg_dapm_widget *widget = elem->widget;
-	struct snd_soc_tplg_mixer_control *mixer_ctrl = ref->mixer_ctrl;
-	struct snd_soc_tplg_enum_control *enum_ctrl = ref->enum_ctrl;
 
 	tplg_dbg("Control '%s' used by '%s'\n", ref->id, elem->id);
 	tplg_dbg("\tparent size: %d + %d -> %d, priv size -> %d\n",
@@ -121,13 +119,10 @@ static int copy_dapm_control(struct tplg_elem *elem, struct tplg_elem *ref)
 
 	elem->widget = widget;
 
-	/* copy new widget at the end */
-	if (ref->type == OBJECT_TYPE_MIXER)
-		memcpy((void*)widget + elem->size, mixer_ctrl, ref->size);
-	else if (ref->type == OBJECT_TYPE_ENUM)
-		memcpy((void*)widget + elem->size, enum_ctrl, ref->size);
-
+	/* append the control to the end of the widget */
+	memcpy((void*)widget + elem->size, ref->obj, ref->size);
 	elem->size += ref->size;
+
 	widget->num_kcontrols++;
 	ref->compound_elem = 1;
 	return 0;
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 topology: print error prefix on error message.

Let the user know it's an error.

---
 src/topology/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/topology/data.c +1 -1
index c768bc5..0901851 100644
@@ -384,7 +384,7 @@ int tplg_copy_data(struct tplg_elem *elem, struct tplg_elem *ref)
 		break;
 
 	default:
-		SNDERR("elem '%s': type %d private data not supported \n",
+		SNDERR("error: elem '%s': type %d private data not supported \n",
 			elem->id, elem->type);
 		return -EINVAL;
 	}
Signature · 1 line
2.1.4
Applied
#2 lore raw

Re: [PATCH] topology: print error prefix on error message.

Quoted 4 lines · Liam Girdwood

Let the user know it's an error.

Applied, thanks.

Takashi

Quoted 20 lines
---
 src/topology/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/topology/data.c +1 -1
index c768bc5..0901851 100644
@@ -384,7 +384,7 @@ int tplg_copy_data(struct tplg_elem *elem, struct tplg_elem *ref)
 		break;
 
 	default:
-		SNDERR("elem '%s': type %d private data not supported \n",
+		SNDERR("error: elem '%s': type %d private data not supported \n",
 			elem->id, elem->type);
 		return -EINVAL;
 	}
Signature · 1 line
2.1.4
Applied
#3 lore raw
In reply to Liam Girdwood
Quoted 7 lines · Liam Girdwood

From: Mengdong Lin <[email protected]>

Copy all DAPM controls types using the same method.

Applied, thanks.

Takashi

Quoted 37 lines
---
 src/topology/dapm.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
src/topology/dapm.c +3 -8
index 7e26ea0..a0a8b86 100644
@@ -107,8 +107,6 @@ static int tplg_parse_dapm_enums(snd_config_t *cfg, struct tplg_elem *elem)
 static int copy_dapm_control(struct tplg_elem *elem, struct tplg_elem *ref)
 {
 	struct snd_soc_tplg_dapm_widget *widget = elem->widget;
-	struct snd_soc_tplg_mixer_control *mixer_ctrl = ref->mixer_ctrl;
-	struct snd_soc_tplg_enum_control *enum_ctrl = ref->enum_ctrl;
 
 	tplg_dbg("Control '%s' used by '%s'\n", ref->id, elem->id);
 	tplg_dbg("\tparent size: %d + %d -> %d, priv size -> %d\n",
@@ -121,13 +119,10 @@ static int copy_dapm_control(struct tplg_elem *elem, struct tplg_elem *ref)
 
 	elem->widget = widget;
 
-	/* copy new widget at the end */
-	if (ref->type == OBJECT_TYPE_MIXER)
-		memcpy((void*)widget + elem->size, mixer_ctrl, ref->size);
-	else if (ref->type == OBJECT_TYPE_ENUM)
-		memcpy((void*)widget + elem->size, enum_ctrl, ref->size);
-
+	/* append the control to the end of the widget */
+	memcpy((void*)widget + elem->size, ref->obj, ref->size);
 	elem->size += ref->size;
+
 	widget->num_kcontrols++;
 	ref->compound_elem = 1;
 	return 0;
Signature · 1 line
2.1.4