Commit c614acf6 authored by Maxime Chevallier's avatar Maxime Chevallier Committed by David S. Miller

net: ethernet: fs_enet: simplify clock handling with devm accessors

devm_clock_get_enabled() can be used to simplify clock handling for the
PER register clock.
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 21c63214
...@@ -900,15 +900,10 @@ static int fs_enet_probe(struct platform_device *ofdev) ...@@ -900,15 +900,10 @@ static int fs_enet_probe(struct platform_device *ofdev)
* but require enable to succeed when a clock was specified/found, * but require enable to succeed when a clock was specified/found,
* keep a reference to the clock upon successful acquisition * keep a reference to the clock upon successful acquisition
*/ */
clk = devm_clk_get(&ofdev->dev, "per"); clk = devm_clk_get_enabled(&ofdev->dev, "per");
if (!IS_ERR(clk)) { if (IS_ERR(clk))
ret = clk_prepare_enable(clk);
if (ret)
goto out_deregister_fixed_link; goto out_deregister_fixed_link;
fpi->clk_per = clk;
}
privsize = sizeof(*fep) + privsize = sizeof(*fep) +
sizeof(struct sk_buff **) * sizeof(struct sk_buff **) *
(fpi->rx_ring + fpi->tx_ring) + (fpi->rx_ring + fpi->tx_ring) +
...@@ -917,7 +912,7 @@ static int fs_enet_probe(struct platform_device *ofdev) ...@@ -917,7 +912,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
ndev = alloc_etherdev(privsize); ndev = alloc_etherdev(privsize);
if (!ndev) { if (!ndev) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_put; goto out_deregister_fixed_link;
} }
SET_NETDEV_DEV(ndev, &ofdev->dev); SET_NETDEV_DEV(ndev, &ofdev->dev);
...@@ -979,8 +974,6 @@ static int fs_enet_probe(struct platform_device *ofdev) ...@@ -979,8 +974,6 @@ static int fs_enet_probe(struct platform_device *ofdev)
fep->ops->cleanup_data(ndev); fep->ops->cleanup_data(ndev);
out_free_dev: out_free_dev:
free_netdev(ndev); free_netdev(ndev);
out_put:
clk_disable_unprepare(fpi->clk_per);
out_deregister_fixed_link: out_deregister_fixed_link:
of_node_put(fpi->phy_node); of_node_put(fpi->phy_node);
if (of_phy_is_fixed_link(ofdev->dev.of_node)) if (of_phy_is_fixed_link(ofdev->dev.of_node))
...@@ -1001,7 +994,6 @@ static void fs_enet_remove(struct platform_device *ofdev) ...@@ -1001,7 +994,6 @@ static void fs_enet_remove(struct platform_device *ofdev)
fep->ops->cleanup_data(ndev); fep->ops->cleanup_data(ndev);
dev_set_drvdata(fep->dev, NULL); dev_set_drvdata(fep->dev, NULL);
of_node_put(fep->fpi->phy_node); of_node_put(fep->fpi->phy_node);
clk_disable_unprepare(fep->fpi->clk_per);
if (of_phy_is_fixed_link(ofdev->dev.of_node)) if (of_phy_is_fixed_link(ofdev->dev.of_node))
of_phy_deregister_fixed_link(ofdev->dev.of_node); of_phy_deregister_fixed_link(ofdev->dev.of_node);
free_netdev(ndev); free_netdev(ndev);
......
...@@ -119,8 +119,6 @@ struct fs_platform_info { ...@@ -119,8 +119,6 @@ struct fs_platform_info {
int napi_weight; /* NAPI weight */ int napi_weight; /* NAPI weight */
int use_rmii; /* use RMII mode */ int use_rmii; /* use RMII mode */
struct clk *clk_per; /* 'per' clock for register access */
}; };
struct fs_enet_private { struct fs_enet_private {
......
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