Commit 9ed0a3fa authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by David S. Miller

net: ethernet: mtk-star-emac: use devm_of_mdiobus_register()

Shrink the code by using the managed variant of of_mdiobus_register().
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 14eeb6e0
...@@ -1389,7 +1389,7 @@ static int mtk_star_mdio_init(struct net_device *ndev) ...@@ -1389,7 +1389,7 @@ static int mtk_star_mdio_init(struct net_device *ndev)
priv->mii->write = mtk_star_mdio_write; priv->mii->write = mtk_star_mdio_write;
priv->mii->priv = priv; priv->mii->priv = priv;
ret = of_mdiobus_register(priv->mii, mdio_node); ret = devm_of_mdiobus_register(dev, priv->mii, mdio_node);
out_put_node: out_put_node:
of_node_put(mdio_node); of_node_put(mdio_node);
...@@ -1441,13 +1441,6 @@ static void mtk_star_clk_disable_unprepare(void *data) ...@@ -1441,13 +1441,6 @@ static void mtk_star_clk_disable_unprepare(void *data)
clk_bulk_disable_unprepare(MTK_STAR_NCLKS, priv->clks); clk_bulk_disable_unprepare(MTK_STAR_NCLKS, priv->clks);
} }
static void mtk_star_mdiobus_unregister(void *data)
{
struct mtk_star_priv *priv = data;
mdiobus_unregister(priv->mii);
}
static int mtk_star_probe(struct platform_device *pdev) static int mtk_star_probe(struct platform_device *pdev)
{ {
struct device_node *of_node; struct device_node *of_node;
...@@ -1549,10 +1542,6 @@ static int mtk_star_probe(struct platform_device *pdev) ...@@ -1549,10 +1542,6 @@ static int mtk_star_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
ret = devm_add_action_or_reset(dev, mtk_star_mdiobus_unregister, priv);
if (ret)
return ret;
ret = eth_platform_get_mac_address(dev, ndev->dev_addr); ret = eth_platform_get_mac_address(dev, ndev->dev_addr);
if (ret || !is_valid_ether_addr(ndev->dev_addr)) if (ret || !is_valid_ether_addr(ndev->dev_addr))
eth_hw_addr_random(ndev); eth_hw_addr_random(ndev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment