All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: "Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>,
	"Jie Yang" <yang.jie@linux.intel.com>,
	"Cezary Rojewski" <cezary.rojewski@intel.com>,
	linux-kernel@vger.kernel.org,
	"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
Subject: [PATCH v2 02/11] ALSA: hdac: Fix codec name after machine driver is unloaded and reloaded
Date: Mon, 17 Jun 2019 13:36:35 +0200	[thread overview]
Message-ID: <20190617113644.25621-3-amadeuszx.slawinski@linux.intel.com> (raw)
In-Reply-To: <20190617113644.25621-1-amadeuszx.slawinski@linux.intel.com>

Currently on each driver reload internal counter is being increased. It
causes failure to enumerate driver devices, as they have hardcoded:
.codec_name = "ehdaudio0D2",
As there is currently no devices with multiple hda codecs and there is
currently no established way to reliably differentiate, between them,
always assign bus->idx = 0;

This fixes a problem when we unload and reload machine driver idx gets
incremented, so .codec_name would've needed to be set to "ehdaudio1D2"
after first reload and so on.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 sound/hda/ext/hdac_ext_bus.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
index a3a113ef5d56..4f9f1d2a2ec5 100644
--- a/sound/hda/ext/hdac_ext_bus.c
+++ b/sound/hda/ext/hdac_ext_bus.c
@@ -85,7 +85,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)
@@ -96,7 +95,12 @@ int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
 		return ret;
 
 	bus->ext_ops = ext_ops;
-	bus->idx = idx++;
+	/* FIXME:
+	 * Currently only one bus is supported, if there is device with more
+	 * buses, bus->idx should be greater than 0, but there needs to be a
+	 * reliable way to always assign same number.
+	 */
+	bus->idx = 0;
 	bus->cmd_dma_state = true;
 
 	return 0;
-- 
2.17.1


  parent reply	other threads:[~2019-06-17 11:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 11:36 [PATCH v2 00/11] Fix driver reload issues Amadeusz Sławiński
2019-06-17 11:36 ` [PATCH v2 01/11] ASoC: Intel: Skylake: Initialize lists before access so they are safe to use Amadeusz Sławiński
2019-06-17 11:36 ` Amadeusz Sławiński [this message]
2019-06-17 15:29   ` [PATCH v2 02/11] ALSA: hdac: Fix codec name after machine driver is unloaded and reloaded Takashi Iwai
2019-06-17 15:29     ` Takashi Iwai
2019-06-17 11:36 ` [PATCH v2 03/11] ASoC: compress: Fix memory leak from snd_soc_new_compress Amadeusz Sławiński
2019-06-25 12:01   ` Mark Brown
2019-06-17 11:36 ` [PATCH v2 04/11] ASoC: Intel: Skylake: Don't return failure on machine driver reload Amadeusz Sławiński
2019-06-17 11:36 ` [PATCH v2 05/11] ASoC: Intel: Skylake: Remove static table index when parsing topology Amadeusz Sławiński
2019-06-26 12:26   ` Mark Brown
2019-06-17 11:36 ` [PATCH v2 06/11] ASoC: Intel: Skylake: Add function to cleanup debugfs interface Amadeusz Sławiński
2019-06-17 11:36 ` [PATCH v2 07/11] ASoC: Intel: Skylake: Properly cleanup on component removal Amadeusz Sławiński
2019-06-17 11:36 ` [PATCH v2 08/11] ASoC: Intel: Skylake: Fix NULL ptr dereference when unloading clk dev Amadeusz Sławiński
2019-06-17 11:36 ` [PATCH v2 09/11] ASoC: Intel: hdac_hdmi: Set ops to NULL on remove Amadeusz Sławiński
2019-06-17 20:51   ` [alsa-devel] " Ranjani Sridharan
2019-06-17 21:36     ` Takashi Iwai
2019-06-18  4:19       ` Ranjani Sridharan
2019-06-18  5:16         ` Takashi Iwai
2019-06-18  5:16           ` Takashi Iwai
2019-06-18 11:00     ` [alsa-devel] " Amadeusz Sławiński
2019-06-18 15:58       ` Ranjani Sridharan
2019-06-19  8:38         ` Amadeusz Sławiński
2019-06-19 21:09           ` Ranjani Sridharan
2019-06-20  6:17             ` Pierre-Louis Bossart
2019-06-24  7:50               ` Amadeusz Sławiński
2019-06-17 11:36 ` [PATCH v2 10/11] ASoC: topology: Consolidate how dtexts and dvalues are freed Amadeusz Sławiński
2019-06-17 11:36 ` [PATCH v2 11/11] ASoC: topology: Consolidate and fix asoc_tplg_dapm_widget_*_create flow Amadeusz Sławiński
2019-06-25  1:17   ` [alsa-devel] " Ranjani Sridharan
2019-06-25 12:04 ` [PATCH v2 00/11] Fix driver reload issues Mark Brown
2019-06-25 13:02   ` [alsa-devel] " Pierre-Louis Bossart

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=20190617113644.25621-3-amadeuszx.slawinski@linux.intel.com \
    --to=amadeuszx.slawinski@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.