aboutsummaryrefslogtreecommitdiffstats
path: root/hw/usb.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-01-11 11:16:20 +0100
committerGerd Hoffmann <kraxel@redhat.com>2012-02-10 11:31:57 +0100
commit7f74a56b1416a759c1da0a280e99242662f350c5 (patch)
treee724d6c71a74dc52cd0ad40086a86f4e6623abc9 /hw/usb.c
parente74495e3ade61ceabc5a00713900d8295e4042f4 (diff)
usb: kill handle_packet callback
All drivers except usb-hub use usb_generic_handle_packet. The only reason the usb hub has its own function is that it used to be called with packets which are intended for downstream devices. With the new, separate device lookup step this doesn't happen any more, so the need for a different handle_packet callback is gone. So we can kill the handle_packet callback and just call usb_generic_handle_packet directly. The special hub handling in usb_handle_packet() can go away for the same reason. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb.c')
-rw-r--r--hw/usb.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/hw/usb.c b/hw/usb.c
index 9976f81bd..638a33984 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -227,7 +227,7 @@ static int do_token_out(USBDevice *s, USBPacket *p)
*
* Returns length of the transaction or one of the USB_RET_XXX codes.
*/
-int usb_generic_handle_packet(USBDevice *s, USBPacket *p)
+static int usb_generic_handle_packet(USBDevice *s, USBPacket *p)
{
/* Rest of the PIDs must match our address */
if (s->state < USB_STATE_DEFAULT || p->devaddr != s->addr)
@@ -318,18 +318,12 @@ int usb_handle_packet(USBDevice *dev, USBPacket *p)
if (dev == NULL) {
return USB_RET_NODEV;
}
+ assert(dev->addr == p->devaddr);
assert(p->owner == NULL);
- ret = usb_device_handle_packet(dev, p);
+ ret = usb_generic_handle_packet(dev, p);
if (ret == USB_RET_ASYNC) {
- if (p->owner == NULL) {
- p->owner = usb_ep_get(dev, p->pid, p->devep);
- } else {
- /* We'll end up here when usb_handle_packet is called
- * recursively due to a hub being in the chain. Nothing
- * to do. Leave p->owner pointing to the device, not the
- * hub. */;
- }
+ p->owner = usb_ep_get(dev, p->pid, p->devep);
}
return ret;
}
@@ -339,7 +333,6 @@ int usb_handle_packet(USBDevice *dev, USBPacket *p)
handle_packet. */
void usb_packet_complete(USBDevice *dev, USBPacket *p)
{
- /* Note: p->owner != dev is possible in case dev is a hub */
assert(p->owner != NULL);
p->owner = NULL;
dev->port->ops->complete(dev->port, p);