summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_hwdep.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-02-23 16:57:04 +0100
committerTakashi Iwai <tiwai@suse.de>2009-02-23 16:57:04 +0100
commita65d629ceb4cff5e7d5edadfd6bf1f64c370a517 (patch)
treeafe9fc6ca83c7e2261ec3032eca34739376514cf /sound/pci/hda/hda_hwdep.c
parent209b14033652f0509912da97fb4a5c8001e64ec0 (diff)
ALSA: hda - Add pseudo device-locking for clear/reconfig
Added the pseudo device-locking using card->shutdown flag to avoid the crash via clear/reconfig during operations. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_hwdep.c')
-rw-r--r--sound/pci/hda/hda_hwdep.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index c660383ef381..4af484b8240c 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -155,7 +155,13 @@ int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec)
static int clear_codec(struct hda_codec *codec)
{
- snd_hda_codec_reset(codec);
+ int err;
+
+ err = snd_hda_codec_reset(codec);
+ if (err < 0) {
+ snd_printk(KERN_ERR "The codec is being used, can't free.\n");
+ return err;
+ }
clear_hwdep_elements(codec);
return 0;
}
@@ -165,7 +171,12 @@ static int reconfig_codec(struct hda_codec *codec)
int err;
snd_printk(KERN_INFO "hda-codec: reconfiguring\n");
- snd_hda_codec_reset(codec);
+ err = snd_hda_codec_reset(codec);
+ if (err < 0) {
+ snd_printk(KERN_ERR
+ "The codec is being used, can't reconfigure.\n");
+ return err;
+ }
err = snd_hda_codec_configure(codec);
if (err < 0)
return err;