/* ethoc_remove() - shutdown OpenCores ethernet MAC @pdev: platform device  */
static int ethoc_remove(struct platform_device *pdev)
/* ethoc_remove() - shutdown OpenCores ethernet MAC @pdev: platform device  */
static int ethoc_remove(struct platform_device *pdev)
{
	struct net_device *netdev = platform_get_drvdata(pdev);
	struct ethoc *priv = netdev_priv(netdev);
	platform_set_drvdata(pdev, NULL);
	if (netdev) {
		phy_disconnect(priv->phy);
		priv->phy = NULL;
		if (priv->mdio) {
			mdiobus_unregister(priv->mdio);
			kfree(priv->mdio->irq);
			mdiobus_free(priv->mdio);
		}
		if (priv->dma_alloc)
			dma_free_coherent(NULL, priv->dma_alloc, priv->membase,
				netdev->mem_start);
		unregister_netdev(netdev);
		free_netdev(netdev);
	}
	return 0;
}