ASoC: Is this bug ? DAPM source vs sink

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Tue Jul 19 08:19:06 CEST 2022


Hi ASoC
Cc Lars-Peter

I have noticed that DAPM source vs sink are strange.

ASoC had used source/sink or input/output before,
but it was exchanged by this patch

	a3423b02cf745c1418f1f199646c450d6fc9ca4e
	("ASoC: dapm: Consolidate input and output path handling")

I think source/sink pair are converted to SND_SOC_DAPM_DIR_IN/OUT
by this patch.

	source <=> IN
	sink   <=> OUT

But, its for_each are inverted

	#define snd_soc_dapm_widget_for_each_sink_path(w, p) \
		snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_IN, p)

	#define snd_soc_dapm_widget_for_each_source_path(w, p) \
		snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_OUT, p)

I have thought this for_each is for special handling,
but, the original was sink is for sink, source is for source after all.

	#define snd_soc_dapm_widget_for_each_sink_path(w, p) \
		list_for_each_entry(p, &w->sinks, list_source)

	#define snd_soc_dapm_widget_for_each_source_path(w, p) \
		list_for_each_entry(p, &w->sources, list_sink)


So, I guess current for_each is wrong, but I'm not 100% sure

	#define snd_soc_dapm_widget_for_each_sink_path(w, p) \
-		snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_IN, p)
+		snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_OUT, p)

	#define snd_soc_dapm_widget_for_each_source_path(w, p) \
-		snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_OUT, p)
+		snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_IN, p)

I'm happy to create patch if I could get your ack.

Thank you for your help !!

Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list