ALSA: hda - Fix yet another race of vga_switcheroo registration
authorTakashi Iwai <tiwai@suse.de>
Tue, 4 Dec 2012 14:09:23 +0000 (15:09 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 4 Dec 2012 15:00:40 +0000 (16:00 +0100)
commitf4c482a4d0b3407cffaa79ef1c516bd5fe1dba13
tree12a5690a8778b18f381536be1773ad71fb101cba
parent0d9741c0e058e2857fe3fed37975515dc8dcd21d
ALSA: hda - Fix yet another race of vga_switcheroo registration

The recent fix for vga switcheroo race in commit 128960a9 opened yet
another race.  At the time the audio driver starts probing, user may
turn off D-GPU off.  But at this moment, the audio driver still
doesn't register the vga switcheroo client, thus the switching isn't
notified.  Then the hardware gets off out of sudden, resulting in
invalid reads and lots of "spurious response" error messages.

For solving this situation, the following changes have been done in
this patch:
- Move again vga switcheroo registration to the very early stage of
  the probing; this also requires to set pci drvdata properly before
  registration
- Introduce the completion to synchronize the driver probe at vga
  switcheroo callbacks; this assures that the whole probing finished
  before executing the callbacks

Reported-by: Daniel J Blueman <daniel@quora.org>
Tested-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_intel.c