[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 2/6] hda-audio: exit cleanup
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH v2 2/6] hda-audio: exit cleanup |
Date: |
Tue, 9 Nov 2010 11:47:45 +0100 |
Add exit callback to the driver. Unregister the sound card properly
on exit.
[ v2: codestyle: add braces ]
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/hda-audio.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/hw/hda-audio.c b/hw/hda-audio.c
index 1035774..c699d6f 100644
--- a/hw/hda-audio.c
+++ b/hw/hda-audio.c
@@ -808,6 +808,28 @@ static int hda_audio_init(HDACodecDevice *hda, const
struct desc_codec *desc)
return 0;
}
+static int hda_audio_exit(HDACodecDevice *hda)
+{
+ HDAAudioState *a = DO_UPCAST(HDAAudioState, hda, hda);
+ HDAAudioStream *st;
+ int i;
+
+ dprint(a, 1, "%s\n", __FUNCTION__);
+ for (i = 0; i < ARRAY_SIZE(a->st); i++) {
+ st = a->st + i;
+ if (st->node == NULL) {
+ continue;
+ }
+ if (st->output) {
+ AUD_close_out(&a->card, st->voice.out);
+ } else {
+ AUD_close_in(&a->card, st->voice.in);
+ }
+ }
+ AUD_remove_card(&a->card);
+ return 0;
+}
+
static int hda_audio_post_load(void *opaque, int version)
{
HDAAudioState *a = opaque;
@@ -879,6 +901,7 @@ static HDACodecDeviceInfo hda_audio_info_output = {
.qdev.vmsd = &vmstate_hda_audio,
.qdev.props = hda_audio_properties,
.init = hda_audio_init_output,
+ .exit = hda_audio_exit,
.command = hda_audio_command,
.stream = hda_audio_stream,
};
@@ -890,6 +913,7 @@ static HDACodecDeviceInfo hda_audio_info_duplex = {
.qdev.vmsd = &vmstate_hda_audio,
.qdev.props = hda_audio_properties,
.init = hda_audio_init_duplex,
+ .exit = hda_audio_exit,
.command = hda_audio_command,
.stream = hda_audio_stream,
};
--
1.7.1
- [Qemu-devel] [PATCH v2 0/6] intel-hda: bugfixes and msi support, Gerd Hoffmann, 2010/11/09
- [Qemu-devel] [PATCH v2 2/6] hda-audio: exit cleanup,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH v2 4/6] intel-hda: update irq status on WAKEEN changes., Gerd Hoffmann, 2010/11/09
- [Qemu-devel] [PATCH v2 6/6] intel-hda: fix codec addressing., Gerd Hoffmann, 2010/11/09
- [Qemu-devel] [PATCH v2 1/6] intel-hda: exit cleanup, Gerd Hoffmann, 2010/11/09
- [Qemu-devel] [PATCH v2 5/6] intel-hda: add msi support, Gerd Hoffmann, 2010/11/09
- [Qemu-devel] [PATCH v2 3/6] intel-hda: Honor WAKEEN bits., Gerd Hoffmann, 2010/11/09
- Re: [Qemu-devel] [PATCH v2 0/6] intel-hda: bugfixes and msi support, malc, 2010/11/09