aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/usb-audio.c1
-rw-r--r--hw/usb-bt.c1
-rw-r--r--hw/usb-bus.c9
-rw-r--r--hw/usb-ccid.c1
-rw-r--r--hw/usb-hid.c1
-rw-r--r--hw/usb-hub.c39
-rw-r--r--hw/usb-msd.c1
-rw-r--r--hw/usb-net.c1
-rw-r--r--hw/usb-serial.c2
-rw-r--r--hw/usb-wacom.c1
-rw-r--r--hw/usb.c15
-rw-r--r--hw/usb.h12
-rw-r--r--usb-bsd.c1
-rw-r--r--usb-linux.c1
-rw-r--r--usb-redir.c1
15 files changed, 4 insertions, 83 deletions
diff --git a/hw/usb-audio.c b/hw/usb-audio.c
index cd589b718a..a4ea0b0fe2 100644
--- a/hw/usb-audio.c
+++ b/hw/usb-audio.c
@@ -691,7 +691,6 @@ static void usb_audio_class_init(ObjectClass *klass, void *data)
k->product_desc = "QEMU USB Audio Interface";
k->usb_desc = &desc_audio;
k->init = usb_audio_initfn;
- k->handle_packet = usb_generic_handle_packet;
k->handle_reset = usb_audio_handle_reset;
k->handle_control = usb_audio_handle_control;
k->handle_data = usb_audio_handle_data;
diff --git a/hw/usb-bt.c b/hw/usb-bt.c
index 90c3b0e0eb..58b247ef41 100644
--- a/hw/usb-bt.c
+++ b/hw/usb-bt.c
@@ -535,7 +535,6 @@ static void usb_bt_class_initfn(ObjectClass *klass, void *data)
uc->init = usb_bt_initfn;
uc->product_desc = "QEMU BT dongle";
uc->usb_desc = &desc_bluetooth;
- uc->handle_packet = usb_generic_handle_packet;
uc->handle_reset = usb_bt_handle_reset;
uc->handle_control = usb_bt_handle_control;
uc->handle_data = usb_bt_handle_data;
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 5c05ed5806..e907d0db79 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -91,15 +91,6 @@ static void usb_device_handle_destroy(USBDevice *dev)
}
}
-int usb_device_handle_packet(USBDevice *dev, USBPacket *p)
-{
- USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev);
- if (klass->handle_packet) {
- return klass->handle_packet(dev, p);
- }
- return -ENOSYS;
-}
-
void usb_device_cancel_packet(USBDevice *dev, USBPacket *p)
{
USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev);
diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c
index 881da3002e..b3bcfeb4ac 100644
--- a/hw/usb-ccid.c
+++ b/hw/usb-ccid.c
@@ -1320,7 +1320,6 @@ static void ccid_class_initfn(ObjectClass *klass, void *data)
uc->init = ccid_initfn;
uc->product_desc = "QEMU USB CCID";
uc->usb_desc = &desc_ccid;
- uc->handle_packet = usb_generic_handle_packet;
uc->handle_reset = ccid_handle_reset;
uc->handle_control = ccid_handle_control;
uc->handle_data = ccid_handle_data;
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 3c4e45da70..c6489800fd 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -557,7 +557,6 @@ static void usb_hid_class_initfn(ObjectClass *klass, void *data)
{
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
- uc->handle_packet = usb_generic_handle_packet;
uc->handle_reset = usb_hid_handle_reset;
uc->handle_control = usb_hid_handle_control;
uc->handle_data = usb_hid_handle_data;
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index bd7641c4bf..22562565c7 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -455,44 +455,6 @@ static int usb_hub_handle_data(USBDevice *dev, USBPacket *p)
return ret;
}
-static int usb_hub_broadcast_packet(USBHubState *s, USBPacket *p)
-{
- USBHubPort *port;
- USBDevice *dev;
- int i, ret;
-
- for(i = 0; i < NUM_PORTS; i++) {
- port = &s->ports[i];
- dev = port->port.dev;
- if (dev && dev->attached && (port->wPortStatus & PORT_STAT_ENABLE)) {
- ret = usb_handle_packet(dev, p);
- if (ret != USB_RET_NODEV) {
- return ret;
- }
- }
- }
- return USB_RET_NODEV;
-}
-
-static int usb_hub_handle_packet(USBDevice *dev, USBPacket *p)
-{
- USBHubState *s = (USBHubState *)dev;
-
-#if defined(DEBUG) && 0
- printf("usb_hub: pid=0x%x\n", pid);
-#endif
- if (dev->state == USB_STATE_DEFAULT &&
- dev->addr != 0 &&
- p->devaddr != dev->addr &&
- (p->pid == USB_TOKEN_SETUP ||
- p->pid == USB_TOKEN_OUT ||
- p->pid == USB_TOKEN_IN)) {
- /* broadcast the packet to the devices */
- return usb_hub_broadcast_packet(s, p);
- }
- return usb_generic_handle_packet(dev, p);
-}
-
static void usb_hub_handle_destroy(USBDevice *dev)
{
USBHubState *s = (USBHubState *)dev;
@@ -562,7 +524,6 @@ static void usb_hub_class_initfn(ObjectClass *klass, void *data)
uc->product_desc = "QEMU USB Hub";
uc->usb_desc = &desc_hub;
uc->find_device = usb_hub_find_device;
- uc->handle_packet = usb_hub_handle_packet;
uc->handle_reset = usb_hub_handle_reset;
uc->handle_control = usb_hub_handle_control;
uc->handle_data = usb_hub_handle_data;
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 6153376f3f..c34cad55fe 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -651,7 +651,6 @@ static void usb_msd_class_initfn(ObjectClass *klass, void *data)
uc->init = usb_msd_initfn;
uc->product_desc = "QEMU USB MSD";
uc->usb_desc = &desc;
- uc->handle_packet = usb_generic_handle_packet;
uc->cancel_packet = usb_msd_cancel_io;
uc->handle_attach = usb_desc_attach;
uc->handle_reset = usb_msd_handle_reset;
diff --git a/hw/usb-net.c b/hw/usb-net.c
index e2111413b4..f00e854756 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1398,7 +1398,6 @@ static void usb_net_class_initfn(ObjectClass *klass, void *data)
uc->init = usb_net_initfn;
uc->product_desc = "QEMU USB Network Interface";
uc->usb_desc = &desc_net;
- uc->handle_packet = usb_generic_handle_packet;
uc->handle_reset = usb_net_handle_reset;
uc->handle_control = usb_net_handle_control;
uc->handle_data = usb_net_handle_data;
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index c2cb6d24e8..cf83cf21de 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -583,7 +583,6 @@ static void usb_serial_class_initfn(ObjectClass *klass, void *data)
uc->init = usb_serial_initfn;
uc->product_desc = "QEMU USB Serial";
uc->usb_desc = &desc_serial;
- uc->handle_packet = usb_generic_handle_packet;
uc->handle_reset = usb_serial_handle_reset;
uc->handle_control = usb_serial_handle_control;
uc->handle_data = usb_serial_handle_data;
@@ -612,7 +611,6 @@ static void usb_braille_class_initfn(ObjectClass *klass, void *data)
uc->init = usb_serial_initfn;
uc->product_desc = "QEMU USB Braille";
uc->usb_desc = &desc_braille;
- uc->handle_packet = usb_generic_handle_packet;
uc->handle_reset = usb_serial_handle_reset;
uc->handle_control = usb_serial_handle_control;
uc->handle_data = usb_serial_handle_data;
diff --git a/hw/usb-wacom.c b/hw/usb-wacom.c
index 14de14d5f7..46b8010f63 100644
--- a/hw/usb-wacom.c
+++ b/hw/usb-wacom.c
@@ -357,7 +357,6 @@ static void usb_wacom_class_init(ObjectClass *klass, void *data)
uc->product_desc = "QEMU PenPartner Tablet";
uc->usb_desc = &desc_wacom;
uc->init = usb_wacom_initfn;
- uc->handle_packet = usb_generic_handle_packet;
uc->handle_reset = usb_wacom_handle_reset;
uc->handle_control = usb_wacom_handle_control;
uc->handle_data = usb_wacom_handle_data;
diff --git a/hw/usb.c b/hw/usb.c
index 9976f81bd7..638a339840 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);
diff --git a/hw/usb.h b/hw/usb.h
index 1beb4b32a9..294c33d85d 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -235,15 +235,6 @@ typedef struct USBDeviceClass {
USBDevice *(*find_device)(USBDevice *dev, uint8_t addr);
/*
- * Process USB packet.
- * Called by the HC (Host Controller).
- *
- * Returns length of the transaction
- * or one of the USB_RET_XXX codes.
- */
- int (*handle_packet)(USBDevice *dev, USBPacket *p);
-
- /*
* Called when a packet is canceled.
*/
void (*cancel_packet)(USBDevice *dev, USBPacket *p);
@@ -360,7 +351,6 @@ void usb_detach(USBPort *port);
void usb_port_reset(USBPort *port);
void usb_device_reset(USBDevice *dev);
void usb_wakeup(USBDevice *dev);
-int usb_generic_handle_packet(USBDevice *s, USBPacket *p);
void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p);
int set_usb_string(uint8_t *buf, const char *str);
@@ -456,8 +446,6 @@ extern const VMStateDescription vmstate_usb_device;
USBDevice *usb_device_find_device(USBDevice *dev, uint8_t addr);
-int usb_device_handle_packet(USBDevice *dev, USBPacket *p);
-
void usb_device_cancel_packet(USBDevice *dev, USBPacket *p);
void usb_device_handle_attach(USBDevice *dev);
diff --git a/usb-bsd.c b/usb-bsd.c
index fc722b3cfa..ca9a1bdc61 100644
--- a/usb-bsd.c
+++ b/usb-bsd.c
@@ -403,7 +403,6 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
uc->product_desc = "USB Host Device";
uc->init = usb_host_initfn;
- uc->handle_packet = usb_generic_handle_packet;
uc->handle_reset = usb_host_handle_reset;
uc->handle_control = usb_host_handle_control;
uc->handle_data = usb_host_handle_data;
diff --git a/usb-linux.c b/usb-linux.c
index e7fc9ecd5c..afb13c4d0f 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1419,7 +1419,6 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
uc->init = usb_host_initfn;
uc->product_desc = "USB Host Device";
- uc->handle_packet = usb_generic_handle_packet;
uc->cancel_packet = usb_host_async_cancel;
uc->handle_data = usb_host_handle_data;
uc->handle_control = usb_host_handle_control;
diff --git a/usb-redir.c b/usb-redir.c
index 0a9295142c..d2769a8431 100644
--- a/usb-redir.c
+++ b/usb-redir.c
@@ -1424,7 +1424,6 @@ static void usbredir_class_initfn(ObjectClass *klass, void *data)
uc->init = usbredir_initfn;
uc->product_desc = "USB Redirection Device";
uc->handle_destroy = usbredir_handle_destroy;
- uc->handle_packet = usb_generic_handle_packet;
uc->cancel_packet = usbredir_cancel_packet;
uc->handle_reset = usbredir_handle_reset;
uc->handle_data = usbredir_handle_data;