summary refs log tree commit diff stats
path: root/hw/usb.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-01-06 15:13:34 +0100
committerGerd Hoffmann <kraxel@redhat.com>2012-02-10 11:12:04 +0100
commitd1f8b53618b3daa93a113ba02520cd1bd34c254b (patch)
treef5a6b7d9b5265374655572b53bd6cb7e59487244 /hw/usb.c
parent6af165892cf900291046f1d25f95416f379504c2 (diff)
downloadfocaccia-qemu-d1f8b53618b3daa93a113ba02520cd1bd34c254b.tar.gz
focaccia-qemu-d1f8b53618b3daa93a113ba02520cd1bd34c254b.zip
usb: kill USB_MSG_{ATTACH,DETACH}
The USB subsystem pipes internal attach/detach notifications through
usb_handle_packet() with a special magic PID.  This indirection is a
pretty pointless excercise as it ends up being handled by
usb_generic_handle_packet anyway.  Remove it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb.c')
-rw-r--r--hw/usb.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/hw/usb.c b/hw/usb.c
index c3ff5b7093..800dd835de 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -35,7 +35,8 @@ void usb_attach(USBPort *port)
     assert(dev->attached);
     assert(dev->state == USB_STATE_NOTATTACHED);
     port->ops->attach(port);
-    usb_send_msg(dev, USB_MSG_ATTACH);
+    dev->state = USB_STATE_ATTACHED;
+    usb_device_handle_attach(dev);
 }
 
 void usb_detach(USBPort *port)
@@ -45,7 +46,7 @@ void usb_detach(USBPort *port)
     assert(dev != NULL);
     assert(dev->state != USB_STATE_NOTATTACHED);
     port->ops->detach(port);
-    usb_send_msg(dev, USB_MSG_DETACH);
+    dev->state = USB_STATE_NOTATTACHED;
 }
 
 void usb_reset(USBPort *port)
@@ -218,15 +219,6 @@ static int do_token_out(USBDevice *s, USBPacket *p)
 int usb_generic_handle_packet(USBDevice *s, USBPacket *p)
 {
     switch(p->pid) {
-    case USB_MSG_ATTACH:
-        s->state = USB_STATE_ATTACHED;
-        usb_device_handle_attach(s);
-        return 0;
-
-    case USB_MSG_DETACH:
-        s->state = USB_STATE_NOTATTACHED;
-        return 0;
-
     case USB_MSG_RESET:
         s->remote_wakeup = 0;
         s->addr = 0;