Thread (6 messages) 6 messages, 3 authors, 2021-10-20

Re: [RFC PATCH v2 2/3] ALSA: hda/realtek: Add support for Legion 7 16ACHg6 laptop Speakers

From: Takashi Iwai <hidden>
Date: 2021-10-20 09:17:27
Also in: alsa-devel, lkml

On Wed, 20 Oct 2021 10:59:43 +0200,
Lucas Tanure wrote:
Find the associated Amps by dai name, and use dai ops to configure it.
Disable support for Amps if ASoC not built.
Hrm, it's the question whether such a sneaking into DAI access in open
code is a good idea.  If any, it could be done by some helper function
instead.

And some more details:
+static int alc_add_soc_dai_list(struct alc_spec *spec, const char *dai_name)
+{
+#if IS_ENABLED(CONFIG_SND_SOC)
+	struct snd_soc_dai_link_component dlc;
+	struct alc_soc_dai_node *dai_node;
+	//struct snd_soc_component *comp;
+	struct snd_soc_dai *dai;
+
+	dlc.dai_name = dai_name;
+	dlc.of_node = NULL;
+	dlc.name = NULL;
+
+	dai = snd_soc_find_dai(&dlc);
+	if (!dai)
+		return -EPROBE_DEFER;
The deferred probe won't work at this stage for HD-audio codecs unlike
many ASoC codec drivers.  And moreover, the fixup action doesn't
handle the error at all...

Second, this way may lead to use-after-free if the ASoC stuff is
unbound while the usage from HD-audio codec side.

Also, the dependency mess is still there.  Even if we allow the hard
binding to ASoC core here, IS_ENABLED() wouldn't work properly.  It
must be IS_REACHABLE().


thanks,

Takashi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help