|
|
59baea1 |
From 12351a91da97b414eec8cdb09f1d9f41e535a401 Mon Sep 17 00:00:00 2001
|
|
|
59baea1 |
From: Li Qiang <liqiang6-s@360.cn>
|
|
|
59baea1 |
Date: Wed, 14 Dec 2016 18:30:21 -0800
|
|
|
59baea1 |
Subject: [PATCH] audio: ac97: add exit function
|
|
|
59baea1 |
MIME-Version: 1.0
|
|
|
59baea1 |
Content-Type: text/plain; charset=utf8
|
|
|
59baea1 |
Content-Transfer-Encoding: 8bit
|
|
|
59baea1 |
|
|
|
59baea1 |
Currently the ac97 device emulation doesn't have a exit function,
|
|
|
59baea1 |
hot unplug this device will leak some memory. Add a exit function to
|
|
|
59baea1 |
avoid this.
|
|
|
59baea1 |
|
|
|
59baea1 |
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
|
|
|
59baea1 |
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
59baea1 |
Message-id: 58520052.4825ed0a.27a71.6cae@mx.google.com
|
|
|
59baea1 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
59baea1 |
---
|
|
|
59baea1 |
hw/audio/ac97.c | 11 +++++++++++
|
|
|
59baea1 |
1 files changed, 11 insertions(+), 0 deletions(-)
|
|
|
59baea1 |
|
|
|
59baea1 |
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
|
|
|
59baea1 |
index cbd959e..c306575 100644
|
|
|
59baea1 |
--- a/hw/audio/ac97.c
|
|
|
59baea1 |
+++ b/hw/audio/ac97.c
|
|
|
59baea1 |
@@ -1387,6 +1387,16 @@ static void ac97_realize(PCIDevice *dev, Error **errp)
|
|
|
59baea1 |
mixer_reset (s);
|
|
|
59baea1 |
}
|
|
|
59baea1 |
|
|
|
59baea1 |
+static void ac97_exit(PCIDevice *dev)
|
|
|
59baea1 |
+{
|
|
|
59baea1 |
+ AC97LinkState *s = DO_UPCAST(AC97LinkState, dev, dev);
|
|
|
59baea1 |
+
|
|
|
59baea1 |
+ AUD_close_in(&s->card, s->voice_pi);
|
|
|
59baea1 |
+ AUD_close_out(&s->card, s->voice_po);
|
|
|
59baea1 |
+ AUD_close_in(&s->card, s->voice_mc);
|
|
|
59baea1 |
+ AUD_remove_card(&s->card);
|
|
|
59baea1 |
+}
|
|
|
59baea1 |
+
|
|
|
59baea1 |
static int ac97_initfn (PCIDevice *dev)
|
|
|
59baea1 |
{
|
|
|
59baea1 |
AC97LinkState *s = DO_UPCAST (AC97LinkState, dev, dev);
|
|
|
59baea1 |
@@ -1404,6 +1414,7 @@ static void ac97_class_init (ObjectClass *klass, void *data)
|
|
|
59baea1 |
PCIDeviceClass *k = PCI_DEVICE_CLASS (klass);
|
|
|
59baea1 |
|
|
|
59baea1 |
k->init = ac97_initfn;
|
|
|
59baea1 |
+ k->exit = ac97_exit;
|
|
|
59baea1 |
k->vendor_id = PCI_VENDOR_ID_INTEL;
|
|
|
59baea1 |
k->device_id = PCI_DEVICE_ID_INTEL_82801AA_5;
|
|
|
59baea1 |
k->revision = 0x01;
|
|
|
59baea1 |
--
|
|
|
59baea1 |
1.7.0.4
|
|
|
59baea1 |
|