Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/cc14e490f4e6002a17c9c7d283fe6a93179766c2.1679814350.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Christophe JAILLET and committed by
Vinod Koul
376c2c9b 827026ae

+7 -28
+7 -28
drivers/dma/mv_xor_v2.c
··· 739 739 if (ret) 740 740 return ret; 741 741 742 - xor_dev->reg_clk = devm_clk_get(&pdev->dev, "reg"); 743 - if (PTR_ERR(xor_dev->reg_clk) != -ENOENT) { 744 - if (!IS_ERR(xor_dev->reg_clk)) { 745 - ret = clk_prepare_enable(xor_dev->reg_clk); 746 - if (ret) 747 - return ret; 748 - } else { 749 - return PTR_ERR(xor_dev->reg_clk); 750 - } 751 - } 742 + xor_dev->reg_clk = devm_clk_get_optional_enabled(&pdev->dev, "reg"); 743 + if (IS_ERR(xor_dev->reg_clk)) 744 + return PTR_ERR(xor_dev->reg_clk); 752 745 753 - xor_dev->clk = devm_clk_get(&pdev->dev, NULL); 754 - if (PTR_ERR(xor_dev->clk) == -EPROBE_DEFER) { 755 - ret = -EPROBE_DEFER; 756 - goto disable_reg_clk; 757 - } 758 - if (!IS_ERR(xor_dev->clk)) { 759 - ret = clk_prepare_enable(xor_dev->clk); 760 - if (ret) 761 - goto disable_reg_clk; 762 - } 746 + xor_dev->clk = devm_clk_get_enabled(&pdev->dev, NULL); 747 + if (IS_ERR(xor_dev->clk)) 748 + return PTR_ERR(xor_dev->clk); 763 749 764 750 ret = platform_msi_domain_alloc_irqs(&pdev->dev, 1, 765 751 mv_xor_v2_set_msi_msg); 766 752 if (ret) 767 - goto disable_clk; 753 + return ret; 768 754 769 755 xor_dev->irq = msi_get_virq(&pdev->dev, 0); 770 756 ··· 852 866 xor_dev->hw_desq_virt, xor_dev->hw_desq); 853 867 free_msi_irqs: 854 868 platform_msi_domain_free_irqs(&pdev->dev); 855 - disable_clk: 856 - clk_disable_unprepare(xor_dev->clk); 857 - disable_reg_clk: 858 - clk_disable_unprepare(xor_dev->reg_clk); 859 869 return ret; 860 870 } 861 871 ··· 870 888 platform_msi_domain_free_irqs(&pdev->dev); 871 889 872 890 tasklet_kill(&xor_dev->irq_tasklet); 873 - 874 - clk_disable_unprepare(xor_dev->clk); 875 - clk_disable_unprepare(xor_dev->reg_clk); 876 891 877 892 return 0; 878 893 }