Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
[cascardo/linux.git] / drivers / net / ethernet / ti / cpsw.c
index ab167dc..952e1e4 100644 (file)
@@ -2392,6 +2392,15 @@ 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);
@@ -2406,6 +2415,7 @@ static int cpsw_remove(struct platform_device *pdev)
        cpdma_chan_destroy(priv->rxch);
        cpdma_ctlr_destroy(priv->dma);
        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);