aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_controller.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-27 12:17:28 -0500
committerTakashi Iwai <tiwai@suse.de>2015-03-03 05:28:12 -0500
commit9a6246ff78ac33af78f82704cde6fec361597eea (patch)
treeabb77fd575a77c4fe97ac1d5b3d76682d465935a /sound/pci/hda/hda_controller.c
parente086e3035e0691b362755d1b5e24df631eee335a (diff)
ALSA: hda - Implement unbind more safely
Now we have all pieces ready, and put them into places: - add the hda_pcm refcount to azx_pcm_open() and azx_pcm_close(), - call the most of cleanup code in hda_codec_reset() from the codec driver remove, - call the same code also from the hda_codec object free. Then the codec driver can be unbound more safely now. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_controller.c')
-rw-r--r--sound/pci/hda/hda_controller.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index ad85f9bfaf57..cae50d5ffb81 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -420,6 +420,7 @@ static int azx_pcm_close(struct snd_pcm_substream *substream)
420 hinfo->ops.close(hinfo, apcm->codec, substream); 420 hinfo->ops.close(hinfo, apcm->codec, substream);
421 snd_hda_power_down(apcm->codec); 421 snd_hda_power_down(apcm->codec);
422 mutex_unlock(&chip->open_mutex); 422 mutex_unlock(&chip->open_mutex);
423 snd_hda_codec_pcm_put(apcm->info);
423 return 0; 424 return 0;
424} 425}
425 426
@@ -806,6 +807,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
806 int err; 807 int err;
807 int buff_step; 808 int buff_step;
808 809
810 snd_hda_codec_pcm_get(apcm->info);
809 mutex_lock(&chip->open_mutex); 811 mutex_lock(&chip->open_mutex);
810 azx_dev = azx_assign_device(chip, substream); 812 azx_dev = azx_assign_device(chip, substream);
811 if (azx_dev == NULL) { 813 if (azx_dev == NULL) {
@@ -887,6 +889,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
887 snd_hda_power_down(apcm->codec); 889 snd_hda_power_down(apcm->codec);
888 unlock: 890 unlock:
889 mutex_unlock(&chip->open_mutex); 891 mutex_unlock(&chip->open_mutex);
892 snd_hda_codec_pcm_put(apcm->info);
890 return err; 893 return err;
891} 894}
892 895