Revision 07771f6f hw/usb-ohci.c

b/hw/usb-ohci.c
1644 1644
    }
1645 1645
}
1646 1646

  
1647
static void ohci_device_destroy(USBBus *bus, USBDevice *dev)
1648
{
1649
    OHCIState *ohci = container_of(bus, OHCIState, bus);
1650

  
1651
    if (ohci->async_td && ohci->usb_packet.owner == dev) {
1652
        usb_cancel_packet(&ohci->usb_packet);
1653
        ohci->async_td = 0;
1654
    }
1655
}
1656

  
1647 1657
/* Only dword reads are defined on OHCI register space */
1648 1658
static CPUReadMemoryFunc * const ohci_readfn[3]={
1649 1659
    ohci_mem_read,
......
1664 1674
    .complete = ohci_async_complete_packet,
1665 1675
};
1666 1676

  
1677
static USBBusOps ohci_bus_ops = {
1678
    .device_destroy = ohci_device_destroy,
1679
};
1680

  
1667 1681
static void usb_ohci_init(OHCIState *ohci, DeviceState *dev,
1668 1682
                          int num_ports, uint32_t localmem_base)
1669 1683
{
......
1691 1705

  
1692 1706
    ohci->name = dev->info->name;
1693 1707

  
1694
    usb_bus_new(&ohci->bus, dev);
1708
    usb_bus_new(&ohci->bus, &ohci_bus_ops, dev);
1695 1709
    ohci->num_ports = num_ports;
1696 1710
    for (i = 0; i < num_ports; i++) {
1697 1711
        usb_register_port(&ohci->bus, &ohci->rhport[i].port, ohci, i, &ohci_port_ops,

Also available in: Unified diff