xHCI: add aborting command ring function
[linux-2.6-block.git] / drivers / usb / host / xhci-mem.c
index 77689bd64cace84001204bb21cc55085c18d94be..487bc083dead0ac0385c81abf81f52917872ac38 100644 (file)
@@ -1772,6 +1772,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
 {
        struct pci_dev  *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
        struct dev_info *dev_info, *next;
+       struct xhci_cd  *cur_cd, *next_cd;
        unsigned long   flags;
        int size;
        int i, j, num_ports;
@@ -1795,6 +1796,11 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
                xhci_ring_free(xhci, xhci->cmd_ring);
        xhci->cmd_ring = NULL;
        xhci_dbg(xhci, "Freed command ring\n");
+       list_for_each_entry_safe(cur_cd, next_cd,
+                       &xhci->cancel_cmd_list, cancel_cmd_list) {
+               list_del(&cur_cd->cancel_cmd_list);
+               kfree(cur_cd);
+       }
 
        for (i = 1; i < MAX_HC_SLOTS; ++i)
                xhci_free_virt_device(xhci, i);
@@ -2340,6 +2346,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
        xhci->cmd_ring = xhci_ring_alloc(xhci, 1, 1, TYPE_COMMAND, flags);
        if (!xhci->cmd_ring)
                goto fail;
+       INIT_LIST_HEAD(&xhci->cancel_cmd_list);
        xhci_dbg(xhci, "Allocated command ring at %p\n", xhci->cmd_ring);
        xhci_dbg(xhci, "First segment DMA is 0x%llx\n",
                        (unsigned long long)xhci->cmd_ring->first_seg->dma);