summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@nxp.com>2020-12-10 21:31:37 +0800
committerPeter Chen <peter.chen@nxp.com>2020-12-29 13:38:42 +0800
commit2ef02b846ee2526249a562a66d6dcb25fcbca9d8 (patch)
treeca85ba8a9de0fe336f7fda0900a0c932cf57bd2d
parent92cbdb923c17544684c2dd3be9f8636617898a44 (diff)
downloadlinux-2ef02b846ee2526249a562a66d6dcb25fcbca9d8.tar.bz2
usb: cdns3: imx: fix can't create core device the second time issue
The cdns3 core device is populated by calling of_platform_populate, the flag OF_POPULATED is set for core device node, if this flag is not cleared, when calling of_platform_populate the second time after loading parent module again, the OF code will not try to create platform device for core device. To fix it, it uses of_platform_depopulate to depopulate the core device which the parent created, and the flag OF_POPULATED for core device node will be cleared accordingly. Cc: <stable@vger.kernel.org> Fixes: 1e056efab993 ("usb: cdns3: add NXP imx8qm glue layer") Signed-off-by: Peter Chen <peter.chen@nxp.com>
-rw-r--r--drivers/usb/cdns3/cdns3-imx.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/usb/cdns3/cdns3-imx.c b/drivers/usb/cdns3/cdns3-imx.c
index 4d3fedc86753..6b358e8be579 100644
--- a/drivers/usb/cdns3/cdns3-imx.c
+++ b/drivers/usb/cdns3/cdns3-imx.c
@@ -218,20 +218,11 @@ err:
return ret;
}
-static int cdns_imx_remove_core(struct device *dev, void *data)
-{
- struct platform_device *pdev = to_platform_device(dev);
-
- platform_device_unregister(pdev);
-
- return 0;
-}
-
static int cdns_imx_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- device_for_each_child(dev, NULL, cdns_imx_remove_core);
+ of_platform_depopulate(dev);
platform_set_drvdata(pdev, NULL);
return 0;