@@ -755,9 +755,11 @@ static void sof_parse_uuid_tokens(struct snd_soc_component *scomp,
755755 void * object ,
756756 const struct sof_topology_token * tokens ,
757757 int count ,
758- struct snd_soc_tplg_vendor_array * array )
758+ struct snd_soc_tplg_vendor_array * array ,
759+ int * index )
759760{
760761 struct snd_soc_tplg_vendor_uuid_elem * elem ;
762+ bool match = false;
761763 int i , j ;
762764
763765 /* parse element by element */
@@ -774,6 +776,12 @@ static void sof_parse_uuid_tokens(struct snd_soc_component *scomp,
774776 if (tokens [j ].token != le32_to_cpu (elem -> token ))
775777 continue ;
776778
779+ /* update index for the first matched token */
780+ if (index && !match ) {
781+ match = true;
782+ (* index )++ ;
783+ }
784+
777785 /* matched - now load token */
778786 tokens [j ].get_token (elem , object , tokens [j ].offset ,
779787 tokens [j ].size );
@@ -785,9 +793,11 @@ static void sof_parse_string_tokens(struct snd_soc_component *scomp,
785793 void * object ,
786794 const struct sof_topology_token * tokens ,
787795 int count ,
788- struct snd_soc_tplg_vendor_array * array )
796+ struct snd_soc_tplg_vendor_array * array ,
797+ int * index )
789798{
790799 struct snd_soc_tplg_vendor_string_elem * elem ;
800+ bool match = false;
791801 int i , j ;
792802
793803 /* parse element by element */
@@ -804,6 +814,12 @@ static void sof_parse_string_tokens(struct snd_soc_component *scomp,
804814 if (tokens [j ].token != le32_to_cpu (elem -> token ))
805815 continue ;
806816
817+ /* update index for the first matched token */
818+ if (index && !match ) {
819+ match = true;
820+ (* index )++ ;
821+ }
822+
807823 /* matched - now load token */
808824 tokens [j ].get_token (elem , object , tokens [j ].offset ,
809825 tokens [j ].size );
@@ -895,11 +911,11 @@ static int sof_parse_tokens(struct snd_soc_component *scomp,
895911 switch (le32_to_cpu (array -> type )) {
896912 case SND_SOC_TPLG_TUPLE_TYPE_UUID :
897913 sof_parse_uuid_tokens (scomp , object , tokens , count ,
898- array );
914+ array , & index );
899915 break ;
900916 case SND_SOC_TPLG_TUPLE_TYPE_STRING :
901917 sof_parse_string_tokens (scomp , object , tokens , count ,
902- array );
918+ array , & index );
903919 break ;
904920 case SND_SOC_TPLG_TUPLE_TYPE_BOOL :
905921 case SND_SOC_TPLG_TUPLE_TYPE_BYTE :
0 commit comments