mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
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>
This commit is contained in:
parent
e74495e3ad
commit
7f74a56b14
15 changed files with 4 additions and 83 deletions
39
hw/usb-hub.c
39
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue