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>
This commit is contained in:
Gerd Hoffmann 2009-09-25 21:42:39 +02:00 committed by Anthony Liguori
parent e3936fa574
commit a8e662b547
8 changed files with 56 additions and 15 deletions

View file

@ -512,9 +512,7 @@ static void usb_msd_handle_destroy(USBDevice *dev)
{
MSDState *s = (MSDState *)dev;
s->scsi_dev->info->destroy(s->scsi_dev);
drive_uninit(s->dinfo->bdrv);
qemu_free(s);
}
static int usb_msd_initfn(USBDevice *dev)