From 07771f6fcebdb12de6dca537423f56299ed9b4b9 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 23 May 2011 17:37:12 +0200 Subject: usb: cancel async packets on unplug This patch adds USBBusOps struct with (for now) only a single callback which is called when a device is about to be destroyed. The USB Host adapters are implementing this callback and use it to cancel any async requests which might be in flight before the device actually goes away. Signed-off-by: Gerd Hoffmann --- hw/milkymist-softusb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'hw/milkymist-softusb.c') diff --git a/hw/milkymist-softusb.c b/hw/milkymist-softusb.c index 1565260279..028f3b79ac 100644 --- a/hw/milkymist-softusb.c +++ b/hw/milkymist-softusb.c @@ -247,10 +247,18 @@ static void softusb_attach(USBPort *port) { } +static void softusb_device_destroy(USBBus *bus, USBDevice *dev) +{ +} + static USBPortOps softusb_ops = { .attach = softusb_attach, }; +static USBBusOps softusb_bus_ops = { + .device_destroy = softusb_device_destroy, +}; + static void milkymist_softusb_reset(DeviceState *d) { MilkymistSoftUsbState *s = @@ -294,7 +302,7 @@ static int milkymist_softusb_init(SysBusDevice *dev) qemu_add_mouse_event_handler(softusb_mouse_event, s, 0, "Milkymist Mouse"); /* create our usb bus */ - usb_bus_new(&s->usbbus, NULL); + usb_bus_new(&s->usbbus, &softusb_bus_ops, NULL); /* our two ports */ usb_register_port(&s->usbbus, &s->usbport[0], NULL, 0, &softusb_ops, -- cgit v1.2.3