提交 db4be8e3 编写于 作者: P Peter Chen 提交者: Zheng Zengkai

usb: cdns3: imx: fix can't create core device the second time issue

stable inclusion
from stable-5.10.11
commit 6b81e926bb986d88fcccf2f34e8d2ff50e30090f
bugzilla: 47621

--------------------------------

commit 2ef02b84 upstream.

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: 1e056efa ("usb: cdns3: add NXP imx8qm glue layer")
Signed-off-by: NPeter Chen <peter.chen@nxp.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 7b69aafe
...@@ -218,20 +218,11 @@ static int cdns_imx_probe(struct platform_device *pdev) ...@@ -218,20 +218,11 @@ static int cdns_imx_probe(struct platform_device *pdev)
return ret; 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) static int cdns_imx_remove(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
device_for_each_child(dev, NULL, cdns_imx_remove_core); of_platform_depopulate(dev);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册