ALSA: hda - Fix registration of beep input device
authorTakashi Iwai <tiwai@suse.de>
Fri, 28 Feb 2014 12:42:09 +0000 (13:42 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 28 Feb 2014 13:02:21 +0000 (14:02 +0100)
commitd604b3990884062873e3bef09ef5e89857c409c3
tree2bb427552257ef1404ac61bb67e212b611fe92ea
parent2b9e4a73fbd90cb8459cf84c12ae05d2eb81da41
ALSA: hda - Fix registration of beep input device

The beep input device is registered via input_register_device(), but
this is called in snd_hda_attach_beep_device() where the sound devices
aren't registered yet.  This leads to the binding to non-existing
object, thus results in failure.  And, even if the binding worked
(against the PCI object), it's still racy; the input device appears
before the sound objects.

For fixing this, register the input device properly at dev_register
ops of the codec object it's bound with.  Also, call
snd_hda_detach_beep_device() at dev_disconnection so that it's
detached at the right timing.  As a bonus, since it's called in the
codec's ops, we can get rid of the further call from the other codec
drivers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_beep.c
sound/pci/hda/hda_beep.h
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_generic.c
sound/pci/hda/patch_conexant.c