From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gonglei <arei.gonglei@huawei.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 12/17] usb-ehci: add ehci-pci device exit function
Date: Fri, 29 Aug 2014 14:03:47 +0200 [thread overview]
Message-ID: <1409313832-2514-13-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1409313832-2514-1-git-send-email-kraxel@redhat.com>
From: Gonglei <arei.gonglei@huawei.com>
clean up ehci resource when ehci pci device exit.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ehci-pci.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
index 505741a..289ca3b 100644
--- a/hw/usb/hcd-ehci-pci.c
+++ b/hw/usb/hcd-ehci-pci.c
@@ -84,6 +84,19 @@ static void usb_ehci_pci_init(Object *obj)
usb_ehci_init(s, DEVICE(obj));
}
+static void usb_ehci_pci_exit(PCIDevice *dev)
+{
+ EHCIPCIState *i = PCI_EHCI(dev);
+ EHCIState *s = &i->ehci;
+
+ usb_ehci_unrealize(s, DEVICE(dev), NULL);
+
+ if (s->irq) {
+ g_free(s->irq);
+ s->irq = NULL;
+ }
+}
+
static void usb_ehci_pci_write_config(PCIDevice *dev, uint32_t addr,
uint32_t val, int l)
{
@@ -121,6 +134,7 @@ static void ehci_class_init(ObjectClass *klass, void *data)
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_ehci_pci_initfn;
+ k->exit = usb_ehci_pci_exit;
k->class_id = PCI_CLASS_SERIAL_USB;
k->config_write = usb_ehci_pci_write_config;
dc->hotpluggable = false;
--
1.8.3.1
next prev parent reply other threads:[~2014-08-29 12:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 01/17] usb: Fix bootindex for portnr > 9 Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 02/17] xhci: fix debug print compiling error Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 03/17] Fix OHCI ISO TD state never being written back Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 04/17] xhci: use (1u << i) Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 05/17] Revert "xhci: Fix number of streams allocated when using streams" Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 06/17] usb: add usb_bus_release function Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 07/17] usb-ohci: Fix memory leak for ohci timer Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 08/17] usb-ohci: add exit function Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 09/17] usb-uhci: clean up uhci resource when pci-uhci exit Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 10/17] usb-ehci: add vmstate properity for EHCIState Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 11/17] usb-ehci: add ehci unrealize funciton Gerd Hoffmann
2014-08-29 12:03 ` Gerd Hoffmann [this message]
2014-08-29 12:03 ` [Qemu-devel] [PULL 13/17] usb-xhci: add exit function Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 14/17] usb: add usb host adapters exit trace Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 15/17] tests: add OHCI qtest Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 16/17] tests: add UHCI qtest Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 17/17] tests: add xHCI qtest Gerd Hoffmann
2014-08-29 13:12 ` [Qemu-devel] [PULL 00/17] usb patch queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409313832-2514-13-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).