summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_sysfs.c')
-rw-r--r--sound/pci/hda/hda_sysfs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_sysfs.c b/sound/pci/hda/hda_sysfs.c
index d5ffcba794e5..0a213aef4124 100644
--- a/sound/pci/hda/hda_sysfs.c
+++ b/sound/pci/hda/hda_sysfs.c
@@ -118,12 +118,15 @@ static int clear_codec(struct hda_codec *codec)
{
int err;
+ snd_power_wait_and_ref(codec->card, true);
err = snd_hda_codec_reset(codec);
if (err < 0) {
codec_err(codec, "The codec is being used, can't free.\n");
+ snd_power_unref(codec->card);
return err;
}
snd_hda_sysfs_clear(codec);
+ snd_power_unref(codec->card);
return 0;
}
@@ -131,6 +134,7 @@ static int reconfig_codec(struct hda_codec *codec)
{
int err;
+ snd_power_wait_and_ref(codec->card, true);
snd_hda_power_up(codec);
codec_info(codec, "hda-codec: reconfiguring\n");
err = snd_hda_codec_reset(codec);
@@ -145,6 +149,7 @@ static int reconfig_codec(struct hda_codec *codec)
err = snd_card_register(codec->card);
error:
snd_hda_power_down(codec);
+ snd_power_unref(codec->card);
return err;
}