From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
alsa-devel@alsa-project.org
Cc: "Cezary Rojewski" <cezary.rojewski@intel.com>,
linux-kernel@vger.kernel.org, "Takashi Iwai" <tiwai@suse.com>,
"Jie Yang" <yang.jie@linux.intel.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>,
"Amadeusz Sławiński" <amadeuszx.slawinski@intel.com>
Subject: Re: [alsa-devel] [PATCH 03/14] ALSA: hdac: Fix codec name after machine driver is unloaded and reloaded
Date: Wed, 5 Jun 2019 10:13:34 -0500 [thread overview]
Message-ID: <a171f010-6901-d256-4cfe-201cbed58970@linux.intel.com> (raw)
In-Reply-To: <20190605134556.10322-4-amadeuszx.slawinski@linux.intel.com>
On 6/5/19 8:45 AM, Amadeusz Sławiński wrote:
> From: Amadeusz Sławiński <amadeuszx.slawinski@intel.com>
>
> This resets internal index used for enumarating codecs. This will only
> work on assumption that platform has one codec. Anyway if there is more,
> it won't work with current machine drivers, because we can't guarantee
> order in which they are enumerated. This workarounds the fact that most
> intel machine drivers have the following defined:
> .codec_name = "ehdaudio0D2",
> However when we unload and reload machine driver idx gets incremented,
> so .codec_name would've needed to be set to ehdaudio1D2 on first reload
> and so on.
>
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@intel.com>
> ---
> sound/hda/ext/hdac_ext_bus.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
> index f33ba58b753c..c84d69c2eba4 100644
> --- a/sound/hda/ext/hdac_ext_bus.c
> +++ b/sound/hda/ext/hdac_ext_bus.c
> @@ -77,6 +77,8 @@ static const struct hdac_io_ops hdac_ext_default_io = {
> .dma_free_pages = hdac_ext_dma_free_pages,
> };
>
> +static int idx;
> +
> /**
> * snd_hdac_ext_bus_init - initialize a HD-audio extended bus
> * @ebus: the pointer to extended bus object
> @@ -93,7 +95,6 @@ int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
> const struct hdac_ext_bus_ops *ext_ops)
> {
> int ret;
> - static int idx;
>
> /* check if io ops are provided, if not load the defaults */
> if (io_ops == NULL)
> @@ -118,6 +119,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_init);
> void snd_hdac_ext_bus_exit(struct hdac_bus *bus)
> {
> snd_hdac_bus_exit(bus);
> + /* FIXME: this is workaround
> + * reset index used for bus->idx, because machine drivers expect
> + * the codec name to be ehdaudio0D2, where 0 is bus->idx
> + * we only perform reset if there is one used device, if there is more
> + * all bets are off
> + */
> + if (idx == 1)
> + idx = 0;
The real fix would be to stop incrementing idx in snd_hdac_ext_bus_init,
which would make sense only if we had multiple controllers. SOF pegged
bus->idx to zero.
> WARN_ON(!list_empty(&bus->hlink_list));
> }
> EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_exit);
>
next prev parent reply other threads:[~2019-06-05 15:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-05 13:45 [PATCH 00/14] Fix driver reload issues Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 01/14] ASoC: Intel: Skylake: Initialize lists before access so they are safe to use Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 02/14] ALSA: hdac: fix memory release for SST and SOF drivers Amadeusz Sławiński
2019-06-05 15:06 ` Pierre-Louis Bossart
2019-06-06 12:57 ` [alsa-devel] " Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 03/14] ALSA: hdac: Fix codec name after machine driver is unloaded and reloaded Amadeusz Sławiński
2019-06-05 15:13 ` Pierre-Louis Bossart [this message]
2019-06-05 13:45 ` [PATCH 04/14] ASoC: compress: Fix memory leak from snd_soc_new_compress Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 05/14] ASoC: Intel: Skylake: Don't return failure on machine driver reload Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 06/14] ASoC: Intel: Skylake: Remove static table index when parsing topology Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 07/14] ASoC: Intel: Skylake: Add function to cleanup debugfs interface Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 08/14] ASoC: Intel: Skylake: Properly cleanup on component removal Amadeusz Sławiński
2019-06-10 7:17 ` Cezary Rojewski
2019-06-10 8:23 ` [alsa-devel] " Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 09/14] ASoC: Intel: Skylake: Fix NULL ptr dereference when unloading clk dev Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 10/14] SoC: rt274: Fix internal jack assignment in set_jack callback Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 11/14] ASoC: core: Tell codec that jack is being removed Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 12/14] ASoC: Intel: hdac_hdmi: Set ops to NULL on remove Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 13/14] ASoC: topology: Consolidate how dtexts and dvalues are freed Amadeusz Sławiński
2019-06-05 13:45 ` [PATCH 14/14] ASoC: topology: Consolidate and fix asoc_tplg_dapm_widget_*_create flow Amadeusz Sławiński
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=a171f010-6901-d256-4cfe-201cbed58970@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@intel.com \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=yang.jie@linux.intel.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;
as well as URLs for NNTP newsgroup(s).