mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: linux-sound@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v2 4/5] ALSA: hda: Stop unsol event and jack polling at hda-ext device removal, too
Date: Fri,  9 Oct 2026 15:33:38 +0200	[thread overview]
Message-ID: <20261009133341.440917-5-tiwai@suse.de> (raw)
In-Reply-To: <20261009133341.440917-1-tiwai@suse.de>

In the recent commit f3607b6952ca ("ALSA: hda: Stop unsol events and
jack polling before codec unbind"), we applied the workaround to stop
pending works at the hda codec driver removal, but it was applied
after the bypass for hda-ext ops hdev_detach.  Basically the same
issue is seen for hda-ext stuff, so it's safer to apply the workaround
at the beginning of hda_codec_driver_remove().

Along with it, the clearance of unsol_disabled flag is moved to the
beginning of hda_codec_driver_probe(), too; otherwise hda-ext
hdev_attach() might miss the unsol event handling when the code gets
re-bound.

Fixes: f3607b6952ca ("ALSA: hda: Stop unsol events and jack polling before codec unbind")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/hda/common/bind.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/hda/common/bind.c b/sound/hda/common/bind.c
index d12359970e74..957feace0f58 100644
--- a/sound/hda/common/bind.c
+++ b/sound/hda/common/bind.c
@@ -92,6 +92,9 @@ static int hda_codec_driver_probe(struct device *dev)
 	bool probed = false;
 	int err;
 
+	/* unsol events are still blocked until registered */
+	codec->core.unsol_disabled = false;
+
 	if (codec->bus->core.ext_ops) {
 		if (WARN_ON(!codec->bus->core.ext_ops->hdev_attach))
 			return -EINVAL;
@@ -101,9 +104,6 @@ static int hda_codec_driver_probe(struct device *dev)
 	if (WARN_ON(!codec->preset))
 		return -EINVAL;
 
-	/* unsol events are still blocked until registered */
-	codec->core.unsol_disabled = false;
-
 	err = snd_hda_codec_set_name(codec, codec->preset->name);
 	if (err < 0)
 		goto error;
@@ -161,16 +161,16 @@ static int hda_codec_driver_remove(struct device *dev)
 	struct hda_codec *codec = dev_to_hda_codec(dev);
 	struct hda_codec_driver *driver = hda_codec_to_driver(codec);
 
+	/* stop asynchronous jack handling before freeing driver resources */
+	snd_hdac_device_disable_unsol(&codec->core);
+	cancel_delayed_work_sync(&codec->jackpoll_work);
+
 	if (codec->bus->core.ext_ops) {
 		if (WARN_ON(!codec->bus->core.ext_ops->hdev_detach))
 			return -EINVAL;
 		return codec->bus->core.ext_ops->hdev_detach(&codec->core);
 	}
 
-	/* stop asynchronous jack handling before freeing driver resources */
-	snd_hdac_device_disable_unsol(&codec->core);
-	cancel_delayed_work_sync(&codec->jackpoll_work);
-
 	snd_hda_codec_disconnect_pcms(codec);
 	snd_hda_jack_tbl_disconnect(codec);
 	snd_refcount_sync(&codec->pcm_ref);
-- 
2.55.0


  parent reply	other threads:[~2026-10-09 13:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 13:33 [PATCH v2 0/5] ALSA: yet a few more fixes for AI bug reports Takashi Iwai
2026-10-09 13:33 ` [PATCH v2 1/5] ALSA: line6: Fix handling of zero-length capture packets Takashi Iwai
2026-10-10  8:04   ` Takashi Iwai
2026-10-09 13:33 ` [PATCH v2 2/5] ALSA: hda: Disable unsol event handling at error and shutdown paths Takashi Iwai
2026-10-09 13:33 ` [PATCH v2 3/5] ALSA: hda: Add lock around codec->registered flag manipulations Takashi Iwai
2026-10-09 13:33 ` Takashi Iwai [this message]
2026-10-09 13:33 ` [PATCH v2 5/5] ALSA: hda: Add NULL check for the driver pointer at unsol event work Takashi Iwai

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=20261009133341.440917-5-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®