Commit 376c2c9b authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Vinod Koul

dmaengine: mv_xor_v2: Use some clk_ helper functions to simplify code

Use devm_clk_get_[optional_]enabled() instead of hand writing it.
It saves some LoC.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/cc14e490f4e6002a17c9c7d283fe6a93179766c2.1679814350.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 827026ae
...@@ -739,32 +739,18 @@ static int mv_xor_v2_probe(struct platform_device *pdev) ...@@ -739,32 +739,18 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
xor_dev->reg_clk = devm_clk_get(&pdev->dev, "reg"); xor_dev->reg_clk = devm_clk_get_optional_enabled(&pdev->dev, "reg");
if (PTR_ERR(xor_dev->reg_clk) != -ENOENT) { if (IS_ERR(xor_dev->reg_clk))
if (!IS_ERR(xor_dev->reg_clk)) { return PTR_ERR(xor_dev->reg_clk);
ret = clk_prepare_enable(xor_dev->reg_clk);
if (ret)
return ret;
} else {
return PTR_ERR(xor_dev->reg_clk);
}
}
xor_dev->clk = devm_clk_get(&pdev->dev, NULL); xor_dev->clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (PTR_ERR(xor_dev->clk) == -EPROBE_DEFER) { if (IS_ERR(xor_dev->clk))
ret = -EPROBE_DEFER; return PTR_ERR(xor_dev->clk);
goto disable_reg_clk;
}
if (!IS_ERR(xor_dev->clk)) {
ret = clk_prepare_enable(xor_dev->clk);
if (ret)
goto disable_reg_clk;
}
ret = platform_msi_domain_alloc_irqs(&pdev->dev, 1, ret = platform_msi_domain_alloc_irqs(&pdev->dev, 1,
mv_xor_v2_set_msi_msg); mv_xor_v2_set_msi_msg);
if (ret) if (ret)
goto disable_clk; return ret;
xor_dev->irq = msi_get_virq(&pdev->dev, 0); xor_dev->irq = msi_get_virq(&pdev->dev, 0);
...@@ -866,10 +852,6 @@ static int mv_xor_v2_probe(struct platform_device *pdev) ...@@ -866,10 +852,6 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
xor_dev->hw_desq_virt, xor_dev->hw_desq); xor_dev->hw_desq_virt, xor_dev->hw_desq);
free_msi_irqs: free_msi_irqs:
platform_msi_domain_free_irqs(&pdev->dev); platform_msi_domain_free_irqs(&pdev->dev);
disable_clk:
clk_disable_unprepare(xor_dev->clk);
disable_reg_clk:
clk_disable_unprepare(xor_dev->reg_clk);
return ret; return ret;
} }
...@@ -889,9 +871,6 @@ static int mv_xor_v2_remove(struct platform_device *pdev) ...@@ -889,9 +871,6 @@ static int mv_xor_v2_remove(struct platform_device *pdev)
tasklet_kill(&xor_dev->irq_tasklet); tasklet_kill(&xor_dev->irq_tasklet);
clk_disable_unprepare(xor_dev->clk);
clk_disable_unprepare(xor_dev->reg_clk);
return 0; return 0;
} }
......
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