Commit c27cb385 authored by make shi's avatar make shi Committed by Jason Liu

ENGR00236169 MX6 USB :kfree udc_controller when remove udc driver

Kree and reset udc_controller should be done when remove udc driver to avoid
kernel dump during modprobe gadget driver after modprobe and rmmod udc driver.
Signed-off-by: 's avatarmake shi <b15407@freescale.com>
parent 4f40f433
...@@ -2911,6 +2911,7 @@ static void fsl_udc_release(struct device *dev) ...@@ -2911,6 +2911,7 @@ static void fsl_udc_release(struct device *dev)
dma_free_coherent(dev, udc_controller->ep_qh_size, dma_free_coherent(dev, udc_controller->ep_qh_size,
udc_controller->ep_qh, udc_controller->ep_qh_dma); udc_controller->ep_qh, udc_controller->ep_qh_dma);
kfree(udc_controller); kfree(udc_controller);
udc_controller = NULL;
} }
/****************************************************************** /******************************************************************
...@@ -3255,8 +3256,7 @@ static int fsl_udc_remove(struct platform_device *pdev) ...@@ -3255,8 +3256,7 @@ static int fsl_udc_remove(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
udc_controller->done = &done; udc_controller->done = &done;
/* open USB PHY clock */ /* open USB PHY clock */
if (udc_controller->stopped) dr_clk_gate(true);
dr_clk_gate(true);
/* disable wake up and otgsc interrupt for safely remove udc driver*/ /* disable wake up and otgsc interrupt for safely remove udc driver*/
temp = fsl_readl(&dr_regs->otgsc); temp = fsl_readl(&dr_regs->otgsc);
...@@ -3296,7 +3296,7 @@ static int fsl_udc_remove(struct platform_device *pdev) ...@@ -3296,7 +3296,7 @@ static int fsl_udc_remove(struct platform_device *pdev)
release_mem_region(res->start, resource_size(res)); release_mem_region(res->start, resource_size(res));
} }
#endif #endif
dr_clk_gate(false);
device_unregister(&udc_controller->gadget.dev); device_unregister(&udc_controller->gadget.dev);
/* free udc --wait for the release() finished */ /* free udc --wait for the release() finished */
wait_for_completion(&done); wait_for_completion(&done);
...@@ -3307,9 +3307,6 @@ static int fsl_udc_remove(struct platform_device *pdev) ...@@ -3307,9 +3307,6 @@ static int fsl_udc_remove(struct platform_device *pdev)
if (pdata->exit) if (pdata->exit)
pdata->exit(pdata->pdev); pdata->exit(pdata->pdev);
if (udc_controller->stopped)
dr_clk_gate(false);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment