Commit 9250dccc authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by David S. Miller

net: ethernet: mtk_star_emac: use devm_register_netdev()

Use the new devres variant of register_netdev() in the mtk-star-emac
driver and shrink the code by a couple lines.
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cd16627f
...@@ -1519,13 +1519,6 @@ static void mtk_star_mdiobus_unregister(void *data) ...@@ -1519,13 +1519,6 @@ static void mtk_star_mdiobus_unregister(void *data)
mdiobus_unregister(priv->mii); mdiobus_unregister(priv->mii);
} }
static void mtk_star_unregister_netdev(void *data)
{
struct net_device *ndev = data;
unregister_netdev(ndev);
}
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;
...@@ -1641,15 +1634,7 @@ static int mtk_star_probe(struct platform_device *pdev) ...@@ -1641,15 +1634,7 @@ static int mtk_star_probe(struct platform_device *pdev)
netif_napi_add(ndev, &priv->napi, mtk_star_poll, MTK_STAR_NAPI_WEIGHT); netif_napi_add(ndev, &priv->napi, mtk_star_poll, MTK_STAR_NAPI_WEIGHT);
ret = register_netdev(ndev); return devm_register_netdev(dev, ndev);
if (ret)
return ret;
ret = devm_add_action_or_reset(dev, mtk_star_unregister_netdev, ndev);
if (ret)
return ret;
return 0;
} }
static const struct of_device_id mtk_star_of_match[] = { static const struct of_device_id mtk_star_of_match[] = {
......
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