diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2012-01-06 15:23:10 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2012-02-10 11:12:04 +0100 |
commit | d28f4e2d86317f7ef7398651e8a1d493e4bf8c88 (patch) | |
tree | d4c76eb6f2378e42f51d59976d0ce652d6358011 /hw/usb.c | |
parent | d1f8b53618b3daa93a113ba02520cd1bd34c254b (diff) | |
download | qemu-d28f4e2d86317f7ef7398651e8a1d493e4bf8c88.zip qemu-d28f4e2d86317f7ef7398651e8a1d493e4bf8c88.tar.gz qemu-d28f4e2d86317f7ef7398651e8a1d493e4bf8c88.tar.bz2 |
usb: kill USB_MSG_RESET
The USB subsystem pipes internal reset 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.
Replace the USB_MSG_RESET with a usb_device_reset() function
which can be called directly. Also rename the existing usb_reset()
function to usb_port_reset() to avoid confusion.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb.c')
-rw-r--r-- | hw/usb.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -49,14 +49,25 @@ void usb_detach(USBPort *port) dev->state = USB_STATE_NOTATTACHED; } -void usb_reset(USBPort *port) +void usb_port_reset(USBPort *port) { USBDevice *dev = port->dev; assert(dev != NULL); usb_detach(port); usb_attach(port); - usb_send_msg(dev, USB_MSG_RESET); + usb_device_reset(dev); +} + +void usb_device_reset(USBDevice *dev) +{ + if (dev == NULL || !dev->attached) { + return; + } + dev->remote_wakeup = 0; + dev->addr = 0; + dev->state = USB_STATE_DEFAULT; + usb_device_handle_reset(dev); } void usb_wakeup(USBDevice *dev) @@ -218,15 +229,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_RESET: - s->remote_wakeup = 0; - s->addr = 0; - s->state = USB_STATE_DEFAULT; - usb_device_handle_reset(s); - return 0; - } - /* Rest of the PIDs must match our address */ if (s->state < USB_STATE_DEFAULT || p->devaddr != s->addr) return USB_RET_NODEV; |