ASoC: topology: log all headers being parsed
PATCH 1/1 ASoC: topology: log all headers being parsed
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.
--- sound/soc/soc-topology.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
sound/soc/soc-topology.c +4 -5
@@ -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 ; }
Signature · 1 line
2.20.1
Kind reminder to always CC: maintainers....
Quoted 3 lines · Keyon Jie
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
Quoted 27 lines
Signed-off-by Keyon Jie <[email protected]>--- sound/soc/soc-topology.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)sound/soc/soc-topology.c +4
-5@@ -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 ; }
Quoted 1 line · Pierre-Louis Bossart
Kind reminder to always CC: maintainers....
Thanks for reminding.
Quoted 7 lines · Keyon Jie
Quoted 3 lines
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_MIXERshould probably not be compared toTPLG_PASS_MANIFEST, but one would think that e.g. theTYPE_MIXERis handled in theTPLG_PASS_MIXER, no? and likewise that in theTPLG_PASS_MANIFESTallTPLG_TYPE_MANIFESTare handled?
Yes, all TYPE_MIXER/ENUM/BYTES are handled in the TPLG_PASS_MIXER, and in the TPLG_PASS_MANIFEST all TPLG_TYPE_MANIFEST are handled, but all these are guaranteed and more details are logged inside the corresponding xxx_load(), at here it is only checking the validity of the header, I think we can log all headers for debug purpose? Imagine that there might be some headers won't be parsed by any xxx_load().
Quoted 2 lines
Shouldn't you add a switch case to reconcile the two lists instead of removing the test altogether?
I can add a function to reconcile the two list, but since we already have "tplg->pass != SOC_TPLG_PASS_xxx" check in each xxx_load(), do you suggest to moving the logging inside these xxx_load() to reduce the redundant check?
Thanks,
~Keyon
Quoted 53 lines
#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 8Quoted 28 lines
Signed-off-by Keyon Jie <[email protected]>---
sound/soc/soc-topology.c| 9 ++++-----1 file changed, 4 insertions(+), 5 deletions(-)sound/soc/soc-topology.c +4
-5@@ -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;}
Quoted 3 lines
I can add a function to reconcile the two list, but since we already have "
tplg->pass!=SOC_TPLG_PASS_xxx" check in eachxxx_load(), do you suggest to moving the logging inside thesexxx_load()to reduce the redundant check?
yes, you could add a static inline sof_tplg_log_hdr(hdr); after each pass check, sounds good to me.
Quoted 5 lines · Pierre-Louis Bossart
Quoted 3 lines
I can add a function to reconcile the two list, but since we already have "
tplg->pass!=SOC_TPLG_PASS_xxx" check in eachxxx_load(), do you suggest to moving the logging inside thesexxx_load()to reduce the redundant check?yes, you could add a static inline
sof_tplg_log_hdr(hdr); after each pass check, sounds good to me.
OK, let me drop this and will send a new one soon.
Thanks,
~Keyon