aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_hwdep.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-02-23 10:57:04 -0500
committerTakashi Iwai <tiwai@suse.de>2009-02-23 10:57:04 -0500
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)
155 155
156static int clear_codec(struct hda_codec *codec) 156static int clear_codec(struct hda_codec *codec)
157{ 157{
158 snd_hda_codec_reset(codec); 158 int err;
159
160 err = snd_hda_codec_reset(codec);
161 if (err < 0) {
162 snd_printk(KERN_ERR "The codec is being used, can't free.\n");
163 return err;
164 }
159 clear_hwdep_elements(codec); 165 clear_hwdep_elements(codec);
160 return 0; 166 return 0;
161} 167}
@@ -165,7 +171,12 @@ static int reconfig_codec(struct hda_codec *codec)
165 int err; 171 int err;
166 172
167 snd_printk(KERN_INFO "hda-codec: reconfiguring\n"); 173 snd_printk(KERN_INFO "hda-codec: reconfiguring\n");
168 snd_hda_codec_reset(codec); 174 err = snd_hda_codec_reset(codec);
175 if (err < 0) {
176 snd_printk(KERN_ERR
177 "The codec is being used, can't reconfigure.\n");
178 return err;
179 }
169 err = snd_hda_codec_configure(codec); 180 err = snd_hda_codec_configure(codec);
170 if (err < 0) 181 if (err < 0)
171 return err; 182 return err;