Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ea8116c authored by Ziqi Chen's avatar Ziqi Chen Committed by Mayank Rana
Browse files

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: default avatarZiqi Chen <ziqic@codeaurora.org>
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 0eb0db78
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -3154,7 +3154,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;
@@ -3450,24 +3450,20 @@ 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);

uninit_iommu:
	if (mdwc->iommu_map) {
		arm_iommu_detach_device(mdwc->dev);
		arm_iommu_release_mapping(mdwc->iommu_map);
	}
	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);
@@ -3504,8 +3500,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);