Revision 07771f6f hw/usb-musb.c

b/hw/usb-musb.c
262 262
static void musb_attach(USBPort *port);
263 263
static void musb_detach(USBPort *port);
264 264
static void musb_schedule_cb(USBDevice *dev, USBPacket *p);
265
static void musb_device_destroy(USBBus *bus, USBDevice *dev);
265 266

  
266 267
static USBPortOps musb_port_ops = {
267 268
    .attach = musb_attach,
......
269 270
    .complete = musb_schedule_cb,
270 271
};
271 272

  
273
static USBBusOps musb_bus_ops = {
274
    .device_destroy = musb_device_destroy,
275
};
276

  
272 277
typedef struct MUSBPacket MUSBPacket;
273 278
typedef struct MUSBEndPoint MUSBEndPoint;
274 279

  
......
361 366
        s->ep[i].epnum = i;
362 367
    }
363 368

  
364
    usb_bus_new(&s->bus, NULL /* FIXME */);
369
    usb_bus_new(&s->bus, &musb_bus_ops, NULL /* FIXME */);
365 370
    usb_register_port(&s->bus, &s->port, s, 0, &musb_port_ops,
366 371
                      USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
367 372
    usb_port_location(&s->port, NULL, 1);
......
778 783
    musb_rx_intr_set(s, epnum, 1);
779 784
}
780 785

  
786
static void musb_device_destroy(USBBus *bus, USBDevice *dev)
787
{
788
    MUSBState *s = container_of(bus, MUSBState, bus);
789
    int ep, dir;
790

  
791
    for (ep = 0; ep < 16; ep++) {
792
        for (dir = 0; dir < 2; dir++) {
793
            if (s->ep[ep].packey[dir].p.owner != dev) {
794
                continue;
795
            }
796
            usb_cancel_packet(&s->ep[ep].packey[dir].p);
797
            /* status updates needed here? */
798
        }
799
    }
800
}
801

  
781 802
static void musb_tx_rdy(MUSBState *s, int epnum)
782 803
{
783 804
    MUSBEndPoint *ep = s->ep + epnum;

Also available in: Unified diff