[PATCH] ASoC: topology: log all headers being parsed

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon May 11 20:38:01 CEST 2020


Kind reminder to always CC: maintainers....

On 5/9/20 3:22 AM, Keyon Jie wrote:
> The check (tplg->pass == le32_to_cpu(hdr->type)) makes no sense as it is
> comparing two different enums, remove the check and log all headers that
> being parsed.

It's true that the TYPE_MIXER should probably not be compared to 
TPLG_PASS_MANIFEST, but one would think that e.g. the TYPE_MIXER is 
handled in the TPLG_PASS_MIXER, no? and likewise that in the 
TPLG_PASS_MANIFEST all TPLG_TYPE_MANIFEST are handled?

Shouldn't you add a switch case to reconcile the two lists instead of 
removing the test altogether?

#define SND_SOC_TPLG_TYPE_MIXER		1
#define SND_SOC_TPLG_TYPE_BYTES		2
#define SND_SOC_TPLG_TYPE_ENUM		3
#define SND_SOC_TPLG_TYPE_DAPM_GRAPH	4
#define SND_SOC_TPLG_TYPE_DAPM_WIDGET	5
#define SND_SOC_TPLG_TYPE_DAI_LINK	6
#define SND_SOC_TPLG_TYPE_PCM		7
#define SND_SOC_TPLG_TYPE_MANIFEST	8
#define SND_SOC_TPLG_TYPE_CODEC_LINK	9
#define SND_SOC_TPLG_TYPE_BACKEND_LINK	10
#define SND_SOC_TPLG_TYPE_PDATA		11
#define SND_SOC_TPLG_TYPE_DAI		12

#define SOC_TPLG_PASS_MANIFEST		0
#define SOC_TPLG_PASS_VENDOR		1
#define SOC_TPLG_PASS_MIXER		2
#define SOC_TPLG_PASS_WIDGET		3
#define SOC_TPLG_PASS_PCM_DAI		4
#define SOC_TPLG_PASS_GRAPH		5
#define SOC_TPLG_PASS_PINS		6
#define SOC_TPLG_PASS_BE_DAI		7
#define SOC_TPLG_PASS_LINK		8


> 
> Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
> ---
>   sound/soc/soc-topology.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
> index 49875978a1ce..58cf5a12af3f 100644
> --- a/sound/soc/soc-topology.c
> +++ b/sound/soc/soc-topology.c
> @@ -2685,11 +2685,10 @@ static int soc_valid_header(struct soc_tplg *tplg,
>   		return -EINVAL;
>   	}
>   
> -	if (tplg->pass == le32_to_cpu(hdr->type))
> -		dev_dbg(tplg->dev,
> -			"ASoC: Got 0x%x bytes of type %d version %d vendor %d at pass %d\n",
> -			hdr->payload_size, hdr->type, hdr->version,
> -			hdr->vendor_type, tplg->pass);
> +	dev_dbg(tplg->dev,
> +		"ASoC: Got 0x%x bytes of type %d version %d vendor %d at pass %d\n",
> +		hdr->payload_size, hdr->type, hdr->version,
> +		hdr->vendor_type, tplg->pass);
>   
>   	return 1;
>   }
> 


More information about the Alsa-devel mailing list