[alsa-devel] [PATCH 4/5] topology: Parse vendor private data for manifest

Takashi Sakamoto o-takashi at sakamocchi.jp
Wed Jul 13 11:56:13 CEST 2016


On Jul 13 2016 17:45, mengdong.lin at linux.intel.com wrote:
> diff --git a/src/topology/data.c b/src/topology/data.c
> index 65054d7..f04544b 100644
> --- a/src/topology/data.c
> +++ b/src/topology/data.c
> @@ -26,6 +26,10 @@ struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem)
>   	struct snd_soc_tplg_private *priv = NULL;
>
>   	switch (elem->type) {
> +	case SND_TPLG_TYPE_MANIFEST:
> +		priv = &elem->manifest->priv;
> +		break;
> +
>   	case SND_TPLG_TYPE_MIXER:
>   		priv = &elem->mixer_ctrl->priv;
>   		break;
> @@ -835,6 +839,101 @@ void tplg_free_tuples(void *obj)
>   	free(tuples->set);
>   }
>
> +/* Parse manifest's data references
> + */
> +int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg,
> +	void *private ATTRIBUTE_UNUSED)
> +{
> +	struct snd_soc_tplg_manifest *manifest;
> +	struct tplg_elem *elem;
> +	snd_config_iterator_t i, next;
> +	snd_config_t *n;
> +	const char *id, *val = NULL;

data.c: In function ‘tplg_parse_manifest_data’:
data.c:851:19: warning: unused variable ‘val’ [-Wunused-variable]
   const char *id, *val = NULL;
                    ^

> +	int err;
> +
> +	if (!list_empty(&tplg->manifest_list)) {
> +		SNDERR("error: already has manifest data\n");
> +		return -EINVAL;
> +	}
> +
> +	elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_MANIFEST);
> +	if (!elem)
> +		return -ENOMEM;
> +
> +	manifest = elem->manifest;
> +	manifest->size = elem->size;
> +
> +	tplg_dbg(" Manifest: %s\n", elem->id);
> +
> +	snd_config_for_each(i, next, cfg) {
> +		n = snd_config_iterator_entry(i);
> +		if (snd_config_get_id(n, &id) < 0)
> +			continue;
> +
> +		/* skip comments */
> +		if (strcmp(id, "comment") == 0)
> +			continue;
> +		if (id[0] == '#')
> +			continue;
> +
> +
> +		if (strcmp(id, "data") == 0) {
> +			err = tplg_parse_data_refs(tplg, n, elem);
> +			if (err < 0)
> +				return err;
> +			continue;
> +		}
> +	}
> +}

data.c:887:1: warning: control reaches end of non-void function 
[-Wreturn-type]
  }
  ^

Regards

Takashi Sakamoto


More information about the Alsa-devel mailing list