From 88d071fc9a93de2916822910c927f28ed15c3a56 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Dec 2013 11:12:28 +0100 Subject: [PATCH] ALSA: hda - Fix complete_all() timing in deferred probes When the probe of snd-hda-intel driver is deferred due to f/w loading or the nested module loading, complete_all() should be also delayed until the initialization really finished. Otherwise, vga-switcheroo client would start switching before the actual init is done. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index c6d2301..27aa140 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -3876,7 +3876,8 @@ static int azx_probe(struct pci_dev *pci, } dev++; - complete_all(&chip->probe_wait); + if (chip->disabled) + complete_all(&chip->probe_wait); return 0; out_free: @@ -3953,10 +3954,10 @@ static int azx_probe_continue(struct azx *chip) if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) || chip->use_vga_switcheroo) pm_runtime_put_noidle(&pci->dev); - return 0; - out_free: - chip->init_failed = 1; + if (err < 0) + chip->init_failed = 1; + complete_all(&chip->probe_wait); return err; } -- 2.7.4