public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Lucas Tanure <tanureal@opensource.cirrus.com>
Cc: Mark Brown <broonie@kernel.org>, Takashi Iwai <tiwai@suse.com>,
	"Jaroslav Kysela" <perex@perex.cz>, Len Brown <lenb@kernel.org>,
	David Rhodes <david.rhodes@cirrus.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	<alsa-devel@alsa-project.org>, <linux-acpi@vger.kernel.org>,
	<patches@opensource.cirrus.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v2 2/3] ALSA: hda/realtek: Add support for Legion 7 16ACHg6 laptop Speakers
Date: Wed, 20 Oct 2021 11:17:24 +0200	[thread overview]
Message-ID: <s5hr1cgys0r.wl-tiwai@suse.de> (raw)
In-Reply-To: <20211020085944.17577-3-tanureal@opensource.cirrus.com>

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

  reply	other threads:[~2021-10-20  9:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20  8:59 [RFC PATCH v2 0/3] Add support for Legion 7 16ACHg6 laptop Lucas Tanure
2021-10-20  8:59 ` [RFC PATCH v2 1/3] sound: cs35l41: Allow HDA systems to use CS35l41 ASoC driver Lucas Tanure
2021-10-20 12:30   ` Mark Brown
2021-10-20  8:59 ` [RFC PATCH v2 2/3] ALSA: hda/realtek: Add support for Legion 7 16ACHg6 laptop Speakers Lucas Tanure
2021-10-20  9:17   ` Takashi Iwai [this message]
2021-10-20  8:59 ` [RFC PATCH v2 3/3] ACPI / scan: Create platform device for INT3515 ACPI nodes Lucas Tanure

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hr1cgys0r.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=david.rhodes@cirrus.com \
    --cc=lenb@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=rafael@kernel.org \
    --cc=tanureal@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox