Skip to content

Commit

Permalink
usb: cdns3: imx: fix can't create core device the second time issue
Browse files Browse the repository at this point in the history
commit 2ef02b8 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: 1e056ef ("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>
  • Loading branch information
Peter Chen authored and gregkh committed Jan 27, 2021
1 parent cc7f1a3 commit 6b81e92
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions drivers/usb/cdns3/cdns3-imx.c
Expand Up @@ -218,20 +218,11 @@ static int cdns_imx_probe(struct platform_device *pdev)
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;
Expand Down

0 comments on commit 6b81e92

Please sign in to comment.