|
@@ -2564,19 +2564,17 @@ clean_ndev_ret:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static int cpsw_remove_child_device(struct device *dev, void *c)
|
|
|
-{
|
|
|
- struct platform_device *pdev = to_platform_device(dev);
|
|
|
-
|
|
|
- of_device_unregister(pdev);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
static int cpsw_remove(struct platform_device *pdev)
|
|
|
{
|
|
|
struct net_device *ndev = platform_get_drvdata(pdev);
|
|
|
struct cpsw_priv *priv = netdev_priv(ndev);
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ ret = pm_runtime_get_sync(&pdev->dev);
|
|
|
+ if (ret < 0) {
|
|
|
+ pm_runtime_put_noidle(&pdev->dev);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
|
|
|
if (priv->data.dual_emac)
|
|
|
unregister_netdev(cpsw_get_slave_ndev(priv, 1));
|
|
@@ -2584,8 +2582,9 @@ static int cpsw_remove(struct platform_device *pdev)
|
|
|
|
|
|
cpsw_ale_destroy(priv->ale);
|
|
|
cpdma_ctlr_destroy(priv->dma);
|
|
|
+ of_platform_depopulate(&pdev->dev);
|
|
|
+ pm_runtime_put_sync(&pdev->dev);
|
|
|
pm_runtime_disable(&pdev->dev);
|
|
|
- device_for_each_child(&pdev->dev, NULL, cpsw_remove_child_device);
|
|
|
if (priv->data.dual_emac)
|
|
|
free_netdev(cpsw_get_slave_ndev(priv, 1));
|
|
|
free_netdev(ndev);
|