Skip to content

Commit

Permalink
net: ethernet: mtk-star-emac: use devm_of_mdiobus_register()
Browse files Browse the repository at this point in the history
Shrink the code by using the managed variant of of_mdiobus_register().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Bartosz Golaszewski authored and David S. Miller committed Jun 30, 2020
1 parent 14eeb6e commit 9ed0a3f
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions drivers/net/ethernet/mediatek/mtk_star_emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ static int mtk_star_mdio_init(struct net_device *ndev)
priv->mii->write = mtk_star_mdio_write;
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:
of_node_put(mdio_node);
Expand Down Expand Up @@ -1441,13 +1441,6 @@ static void mtk_star_clk_disable_unprepare(void *data)
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)
{
struct device_node *of_node;
Expand Down Expand Up @@ -1549,10 +1542,6 @@ static int mtk_star_probe(struct platform_device *pdev)
if (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);
if (ret || !is_valid_ether_addr(ndev->dev_addr))
eth_hw_addr_random(ndev);
Expand Down

0 comments on commit 9ed0a3f

Please sign in to comment.