diff options
author | Gonglei <arei.gonglei@huawei.com> | 2014-06-04 16:31:49 +0800 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-08-29 12:52:13 +0200 |
commit | 3a3464b000776c21d0b650036cbdfdc45e9eb172 (patch) | |
tree | c0f46c09c3d48df7207f812c953f400c7af0bc25 /hw/usb/hcd-uhci.c | |
parent | 07832c38d3c359f909609c4ab68ccc0d3282d7ee (diff) |
usb-uhci: clean up uhci resource when pci-uhci exit
clean up uhci resource when uhci pci device exit.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/hcd-uhci.c')
-rw-r--r-- | hw/usb/hcd-uhci.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index ee5f112d65..220115bc5a 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; |