[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/17] usb-uhci: clean up uhci resource when pci-uhci
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 09/17] usb-uhci: clean up uhci resource when pci-uhci exit |
Date: |
Fri, 29 Aug 2014 14:03:44 +0200 |
From: Gonglei <address@hidden>
clean up uhci resource when uhci pci device exit.
Signed-off-by: Gonglei <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/hcd-uhci.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index ee5f112..220115b 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1256,6 +1256,27 @@ static int usb_uhci_vt82c686b_initfn(PCIDevice *dev)
return usb_uhci_common_initfn(dev);
}
+static void usb_uhci_exit(PCIDevice *dev)
+{
+ UHCIState *s = DO_UPCAST(UHCIState, dev, dev);
+
+ if (s->frame_timer) {
+ timer_del(s->frame_timer);
+ timer_free(s->frame_timer);
+ s->frame_timer = NULL;
+ }
+
+ if (s->bh) {
+ qemu_bh_delete(s->bh);
+ }
+
+ uhci_async_cancel_all(s);
+
+ if (!s->masterbus) {
+ usb_bus_release(&s->bus);
+ }
+}
+
static Property uhci_properties[] = {
DEFINE_PROP_STRING("masterbus", UHCIState, masterbus),
DEFINE_PROP_UINT32("firstport", UHCIState, firstport, 0),
@@ -1272,6 +1293,7 @@ static void uhci_class_init(ObjectClass *klass, void
*data)
UHCIInfo *info = data;
k->init = info->initfn ? info->initfn : usb_uhci_common_initfn;
+ k->exit = info->unplug ? usb_uhci_exit : NULL;
k->vendor_id = info->vendor_id;
k->device_id = info->device_id;
k->revision = info->revision;
--
1.8.3.1
- [Qemu-devel] [PULL 10/17] usb-ehci: add vmstate properity for EHCIState, (continued)
- [Qemu-devel] [PULL 10/17] usb-ehci: add vmstate properity for EHCIState, Gerd Hoffmann, 2014/08/29
- [Qemu-devel] [PULL 12/17] usb-ehci: add ehci-pci device exit function, Gerd Hoffmann, 2014/08/29
- [Qemu-devel] [PULL 06/17] usb: add usb_bus_release function, Gerd Hoffmann, 2014/08/29
- [Qemu-devel] [PULL 13/17] usb-xhci: add exit function, Gerd Hoffmann, 2014/08/29
- [Qemu-devel] [PULL 15/17] tests: add OHCI qtest, Gerd Hoffmann, 2014/08/29
- [Qemu-devel] [PULL 03/17] Fix OHCI ISO TD state never being written back., Gerd Hoffmann, 2014/08/29
- [Qemu-devel] [PULL 14/17] usb: add usb host adapters exit trace, Gerd Hoffmann, 2014/08/29
- [Qemu-devel] [PULL 07/17] usb-ohci: Fix memory leak for ohci timer, Gerd Hoffmann, 2014/08/29
- [Qemu-devel] [PULL 17/17] tests: add xHCI qtest, Gerd Hoffmann, 2014/08/29
- [Qemu-devel] [PULL 16/17] tests: add UHCI qtest, Gerd Hoffmann, 2014/08/29
- [Qemu-devel] [PULL 09/17] usb-uhci: clean up uhci resource when pci-uhci exit,
Gerd Hoffmann <=
- Re: [Qemu-devel] [PULL 00/17] usb patch queue, Peter Maydell, 2014/08/29