summary refs log tree commit diff stats
path: root/hw/usb.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-12-01 11:27:05 +0100
committerGerd Hoffmann <kraxel@redhat.com>2011-01-11 17:01:02 +0100
commit618c169b577db64ac6589ad48825d2e11760d1a6 (patch)
treeb9b60ddfcf2d07041117ec425118deb06437cf01 /hw/usb.h
parent0d86d2bebb625a222f70b76972139f6a272e3e0b (diff)
downloadfocaccia-qemu-618c169b577db64ac6589ad48825d2e11760d1a6.tar.gz
focaccia-qemu-618c169b577db64ac6589ad48825d2e11760d1a6.zip
usb: rework attach/detach workflow
Add separate detach callback to USBPortOps, split
uhci/ohci/musb/usbhub attach functions into two.

Move common code to the usb_attach() function, only
the hardware-specific bits remain in the attach/detach
callbacks.

Keep track of the port it is attached to for each usb device.

[ v3: fix tyops in usb-musb.c ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb.h')
-rw-r--r--hw/usb.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/usb.h b/hw/usb.h
index 218788fceb..3744d19be3 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -147,6 +147,7 @@ struct USBDescString {
 struct USBDevice {
     DeviceState qdev;
     USBDeviceInfo *info;
+    USBPort *port;
     void *opaque;
 
     int speed;
@@ -217,7 +218,8 @@ struct USBDeviceInfo {
 };
 
 typedef struct USBPortOps {
-    void (*attach)(USBPort *port, USBDevice *dev);
+    void (*attach)(USBPort *port);
+    void (*detach)(USBPort *port);
 } USBPortOps;
 
 /* USB port on which a device can be connected */