All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] topology: treat all DAPM controls types the same when copying
@ 2015-08-07 15:39 Liam Girdwood
  2015-08-07 15:39 ` [PATCH] topology: print error prefix on error message Liam Girdwood
  2015-08-07 16:07 ` [PATCH] topology: treat all DAPM controls types the same when copying Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: Liam Girdwood @ 2015-08-07 15:39 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai, Mengdong Lin, Mark Brown, Liam Girdwood

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

Copy all DAPM controls types using the same method.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
---
 src/topology/dapm.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/topology/dapm.c b/src/topology/dapm.c
index 7e26ea0..a0a8b86 100644
--- a/src/topology/dapm.c
+++ b/src/topology/dapm.c
@@ -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;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] topology: print error prefix on error message.
  2015-08-07 15:39 [PATCH] topology: treat all DAPM controls types the same when copying Liam Girdwood
@ 2015-08-07 15:39 ` Liam Girdwood
  2015-08-07 16:07   ` Takashi Iwai
  2015-08-07 16:07 ` [PATCH] topology: treat all DAPM controls types the same when copying Takashi Iwai
  1 sibling, 1 reply; 4+ messages in thread
From: Liam Girdwood @ 2015-08-07 15:39 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai, Liam Girdwood, Mark Brown

Let the user know it's an error.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
---
 src/topology/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/topology/data.c b/src/topology/data.c
index c768bc5..0901851 100644
--- a/src/topology/data.c
+++ b/src/topology/data.c
@@ -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;
 	}
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] topology: treat all DAPM controls types the same when copying
  2015-08-07 15:39 [PATCH] topology: treat all DAPM controls types the same when copying Liam Girdwood
  2015-08-07 15:39 ` [PATCH] topology: print error prefix on error message Liam Girdwood
@ 2015-08-07 16:07 ` Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2015-08-07 16:07 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: Mengdong Lin, alsa-devel, Mark Brown

On Fri, 07 Aug 2015 17:39:15 +0200,
Liam Girdwood wrote:
> 
> From: Mengdong Lin <mengdong.lin@intel.com>
> 
> Copy all DAPM controls types using the same method.
> 
> Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

Applied, thanks.


Takashi

> ---
>  src/topology/dapm.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/src/topology/dapm.c b/src/topology/dapm.c
> index 7e26ea0..a0a8b86 100644
> --- a/src/topology/dapm.c
> +++ b/src/topology/dapm.c
> @@ -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;
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] topology: print error prefix on error message.
  2015-08-07 15:39 ` [PATCH] topology: print error prefix on error message Liam Girdwood
@ 2015-08-07 16:07   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2015-08-07 16:07 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, Mark Brown

On Fri, 07 Aug 2015 17:39:16 +0200,
Liam Girdwood wrote:
> 
> Let the user know it's an error.
> 
> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

Applied, thanks.


Takashi

> ---
>  src/topology/data.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/topology/data.c b/src/topology/data.c
> index c768bc5..0901851 100644
> --- a/src/topology/data.c
> +++ b/src/topology/data.c
> @@ -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;
>  	}
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-07 16:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-07 15:39 [PATCH] topology: treat all DAPM controls types the same when copying Liam Girdwood
2015-08-07 15:39 ` [PATCH] topology: print error prefix on error message Liam Girdwood
2015-08-07 16:07   ` Takashi Iwai
2015-08-07 16:07 ` [PATCH] topology: treat all DAPM controls types the same when copying Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.