usb: gadget: amd5536udc: use free_dma_pools
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Tue, 22 Sep 2015 13:24:29 +0000 (18:54 +0530)
committerFelipe Balbi <balbi@ti.com>
Thu, 1 Oct 2015 17:40:20 +0000 (12:40 -0500)
We have the function free_dma_pools() which frees all the dma pools. Use
it instead of calling all the functions separately. The if conditions
for data_requests and stp_requests are also not required here as this is
the remove function and we are here means probe has succeeded and dma
has been successfully allocated, so they cannot be NULL here.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/udc/amd5536udc.c

index 6223b1b..7805b29 100644 (file)
@@ -3131,20 +3131,7 @@ static void udc_pci_remove(struct pci_dev *pdev)
                return;
 
        /* dma pool cleanup */
-       if (dev->data_requests)
-               pci_pool_destroy(dev->data_requests);
-
-       if (dev->stp_requests) {
-               /* cleanup DMA desc's for ep0in */
-               pci_pool_free(dev->stp_requests,
-                       dev->ep[UDC_EP0OUT_IX].td_stp,
-                       dev->ep[UDC_EP0OUT_IX].td_stp_dma);
-               pci_pool_free(dev->stp_requests,
-                       dev->ep[UDC_EP0OUT_IX].td,
-                       dev->ep[UDC_EP0OUT_IX].td_phys);
-
-               pci_pool_destroy(dev->stp_requests);
-       }
+       free_dma_pools(dev);
 
        /* reset controller */
        writel(AMD_BIT(UDC_DEVCFG_SOFTRESET), &dev->regs->cfg);