usb: cdns3: imx: fix can't create core device the second time issue
authorPeter Chen <peter.chen@nxp.com>
Thu, 10 Dec 2020 13:31:37 +0000 (21:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jan 2021 10:55:17 +0000 (11:55 +0100)
commit6b81e926bb986d88fcccf2f34e8d2ff50e30090f
tree4d39b1da6abdddeb2ca27018446247cb3e93d976
parentcc7f1a32424ef6689665a91e66c43f6836889623
usb: cdns3: imx: fix can't create core device the second time issue

commit 2ef02b846ee2526249a562a66d6dcb25fcbca9d8 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: 1e056efab993 ("usb: cdns3: add NXP imx8qm glue layer")
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/cdns3/cdns3-imx.c