summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3/dwc3-msm.c
diff options
context:
space:
mode:
authorZiqi Chen <ziqic@codeaurora.org>2017-08-04 18:17:55 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-08-09 20:23:50 -0700
commit44530217e837dbe84b660718dcf89ab392c50658 (patch)
tree0a4b92b65f7cfefc1643109df0d3e6dd973e6d2e /drivers/usb/dwc3/dwc3-msm.c
parentbb7cc76a8f1592fc14f5e68ecdd20a40604af2c7 (diff)
usb: dwc3: msm: clear resource on dwc3_msm_probe defer
In dwc3_msm_probe, when need to defer probe, driver should clear resource has been allocated and de-attach the children device. of_platform_depopulate is the complement of of_platform_populate to remove devices created here. And driver also needs to destroy workqueue in error case. Change-Id: I234198eba45842f86c736dd459096ebc4fced807 Signed-off-by: Ziqi Chen <ziqic@codeaurora.org>
Diffstat (limited to 'drivers/usb/dwc3/dwc3-msm.c')
-rw-r--r--drivers/usb/dwc3/dwc3-msm.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c
index 70db070b05d8..6eba6e593451 100644
--- a/drivers/usb/dwc3/dwc3-msm.c
+++ b/drivers/usb/dwc3/dwc3-msm.c
@@ -2898,7 +2898,7 @@ static int dwc3_msm_probe(struct platform_device *pdev)
ret = dwc3_msm_get_clk_gdsc(mdwc);
if (ret) {
dev_err(&pdev->dev, "error getting clock or gdsc.\n");
- return ret;
+ goto err;
}
mdwc->id_state = DWC3_ID_FLOAT;
@@ -3206,19 +3206,14 @@ static int dwc3_msm_probe(struct platform_device *pdev)
return 0;
put_dwc3:
- platform_device_put(mdwc->dwc3);
if (mdwc->bus_perf_client)
msm_bus_scale_unregister_client(mdwc->bus_perf_client);
+ of_platform_depopulate(&pdev->dev);
err:
+ destroy_workqueue(mdwc->dwc3_wq);
return ret;
}
-static int dwc3_msm_remove_children(struct device *dev, void *data)
-{
- device_unregister(dev);
- return 0;
-}
-
static int dwc3_msm_remove(struct platform_device *pdev)
{
struct dwc3_msm *mdwc = platform_get_drvdata(pdev);
@@ -3255,8 +3250,7 @@ static int dwc3_msm_remove(struct platform_device *pdev)
if (mdwc->hs_phy)
mdwc->hs_phy->flags &= ~PHY_HOST_MODE;
- platform_device_put(mdwc->dwc3);
- device_for_each_child(&pdev->dev, NULL, dwc3_msm_remove_children);
+ of_platform_depopulate(&pdev->dev);
dbg_event(0xFF, "Remov put", 0);
pm_runtime_disable(mdwc->dev);