Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li <frank.li@xxxxxxxx> --- drivers/net/dsa/rzn1_a5psw.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c index 92e032972b34..9627c6550a93 100644 --- a/drivers/net/dsa/rzn1_a5psw.c +++ b/drivers/net/dsa/rzn1_a5psw.c @@ -1228,35 +1228,27 @@ static int a5psw_probe(struct platform_device *pdev) if (ret) return ret; - a5psw->hclk = devm_clk_get(dev, "hclk"); + a5psw->hclk = devm_clk_get_enabled(dev, "hclk"); if (IS_ERR(a5psw->hclk)) { dev_err(dev, "failed get hclk clock\n"); ret = PTR_ERR(a5psw->hclk); goto free_pcs; } - a5psw->clk = devm_clk_get(dev, "clk"); + a5psw->clk = devm_clk_get_enabled(dev, "clk"); if (IS_ERR(a5psw->clk)) { dev_err(dev, "failed get clk_switch clock\n"); ret = PTR_ERR(a5psw->clk); goto free_pcs; } - ret = clk_prepare_enable(a5psw->clk); - if (ret) - goto free_pcs; - - ret = clk_prepare_enable(a5psw->hclk); - if (ret) - goto clk_disable; - mdio = of_get_child_by_name(dev->of_node, "mdio"); if (of_device_is_available(mdio)) { ret = a5psw_probe_mdio(a5psw, mdio); if (ret) { of_node_put(mdio); dev_err(dev, "Failed to register MDIO: %d\n", ret); - goto hclk_disable; + goto free_pcs; } } @@ -1272,15 +1264,11 @@ static int a5psw_probe(struct platform_device *pdev) ret = dsa_register_switch(ds); if (ret) { dev_err(dev, "Failed to register DSA switch: %d\n", ret); - goto hclk_disable; + goto free_pcs; } return 0; -hclk_disable: - clk_disable_unprepare(a5psw->hclk); -clk_disable: - clk_disable_unprepare(a5psw->clk); free_pcs: a5psw_pcs_free(a5psw); @@ -1296,8 +1284,6 @@ static void a5psw_remove(struct platform_device *pdev) dsa_unregister_switch(&a5psw->ds); a5psw_pcs_free(a5psw); - clk_disable_unprepare(a5psw->hclk); - clk_disable_unprepare(a5psw->clk); } static void a5psw_shutdown(struct platform_device *pdev) -- 2.39.0