aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-hub.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-09-25 21:42:39 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-05 09:32:48 -0500
commita8e662b5477a7e3659c7fc2d83db50c42b201c1d (patch)
tree12dcfa0a4ef0960eec14ff44b772c8e0a5e80061 /hw/usb-hub.c
parente3936fa574d9fbe241acdc76b5195b048567537e (diff)
downloadqemu-a8e662b5477a7e3659c7fc2d83db50c42b201c1d.zip
qemu-a8e662b5477a7e3659c7fc2d83db50c42b201c1d.tar.gz
qemu-a8e662b5477a7e3659c7fc2d83db50c42b201c1d.tar.bz2
usb: hook unplug into qdev, cleanups + fixes.
Hook into DeviceInfo->exit(). handle_destroy() must not free the state struct, this is handled by the new usb_qdev_exit() function now. qdev_free(usb_device) works now. Fix usb hub to qdev_free() all connected devices on unplug. Unplugging a usb hub works now. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/usb-hub.c')
-rw-r--r--hw/usb-hub.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index 0a39986..e5a0938 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -517,8 +517,12 @@ static int usb_hub_handle_packet(USBDevice *dev, USBPacket *p)
static void usb_hub_handle_destroy(USBDevice *dev)
{
USBHubState *s = (USBHubState *)dev;
+ int i;
- qemu_free(s);
+ for (i = 0; i < s->nb_ports; i++) {
+ usb_unregister_port(usb_bus_from_device(dev),
+ &s->ports[i].port);
+ }
}
static int usb_hub_initfn(USBDevice *dev)