]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ALSA: hda: intel: Drop obsolete probe-work unlock workaround
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Sat, 28 Mar 2026 23:42:01 +0000 (20:42 -0300)
committerTakashi Iwai <tiwai@suse.de>
Sun, 29 Mar 2026 09:07:04 +0000 (11:07 +0200)
Commit ab949d519601 ("ALSA: hda - Fix deadlock of controller device
lock at unbinding") added a temporary device_unlock()/device_lock()
pair around probe-work cancellation to avoid a deadlock between
controller unbind and codec probe.

That deadlock depended on the driver core taking both a device lock and
its parent lock during bind and unbind. Since commit 8c97a46af04b
("driver core: hold dev's parent lock when needed") and follow-up
fixes, the parent lock is only taken when bus->need_parent_lock is set.
The HDA bus does not set that flag, so codec binding no longer locks
the controller device as the codec's parent.

Keep cancel_delayed_work_sync(), since the async probe/remove race
still needs to be serialized, but drop the stale unlock/relock
workaround and its outdated FIXME comment. Keeping it around only
opens an unnecessary unlocked window inside azx_remove().

Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260328-hda-intel-drop-obsolete-probe-workaround-v1-1-bc43aeafc98b@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/hda/controllers/intel.c

index 3f434994c18db64019d3b4cfff8a7cc8764b5f26..89de18dc953d23a4ea97a584c19e062c0d94d02b 100644 (file)
@@ -2421,20 +2421,7 @@ static void azx_remove(struct pci_dev *pci)
                /* cancel the pending probing work */
                chip = card->private_data;
                hda = container_of(chip, struct hda_intel, chip);
-               /* FIXME: below is an ugly workaround.
-                * Both device_release_driver() and driver_probe_device()
-                * take *both* the device's and its parent's lock before
-                * calling the remove() and probe() callbacks.  The codec
-                * probe takes the locks of both the codec itself and its
-                * parent, i.e. the PCI controller dev.  Meanwhile, when
-                * the PCI controller is unbound, it takes its lock, too
-                * ==> ouch, a deadlock!
-                * As a workaround, we unlock temporarily here the controller
-                * device during cancel_work_sync() call.
-                */
-               device_unlock(&pci->dev);
                cancel_delayed_work_sync(&hda->probe_work);
-               device_lock(&pci->dev);
 
                clear_bit(chip->dev_index, probed_devs);
                pci_set_drvdata(pci, NULL);