summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-pic32.c
diff options
context:
space:
mode:
authorLi Zetao <lizetao1@huawei.com>2023-08-23 15:39:36 +0200
committerMark Brown <broonie@kernel.org>2023-09-11 02:32:11 +0200
commit6b6cc88c4e5b42d2ba6af43152af6d9d96872ee8 (patch)
tree25ffc7bb85a60804f84bfbdc76a4f2ef66ba4757 /drivers/spi/spi-pic32.c
parentspi: pic32-sqi: Use helper function devm_clk_get_enabled() (diff)
downloadlinux-6b6cc88c4e5b42d2ba6af43152af6d9d96872ee8.tar.xz
linux-6b6cc88c4e5b42d2ba6af43152af6d9d96872ee8.zip
spi: pic32: Use helper function devm_clk_get_enabled()
Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Li Zetao <lizetao1@huawei.com> Link: https://lore.kernel.org/r/20230823133938.1359106-24-lizetao1@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/spi/spi-pic32.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
index 52b788dac10a..f55b38c577e4 100644
--- a/drivers/spi/spi-pic32.c
+++ b/drivers/spi/spi-pic32.c
@@ -730,17 +730,13 @@ static int pic32_spi_hw_probe(struct platform_device *pdev,
return pic32s->tx_irq;
/* get clock */
- pic32s->clk = devm_clk_get(&pdev->dev, "mck0");
+ pic32s->clk = devm_clk_get_enabled(&pdev->dev, "mck0");
if (IS_ERR(pic32s->clk)) {
dev_err(&pdev->dev, "clk not found\n");
ret = PTR_ERR(pic32s->clk);
goto err_unmap_mem;
}
- ret = clk_prepare_enable(pic32s->clk);
- if (ret)
- goto err_unmap_mem;
-
pic32_spi_hw_init(pic32s);
return 0;
@@ -837,7 +833,6 @@ static int pic32_spi_probe(struct platform_device *pdev)
err_bailout:
pic32_spi_dma_unprep(pic32s);
- clk_disable_unprepare(pic32s->clk);
err_host:
spi_controller_put(host);
return ret;
@@ -849,7 +844,6 @@ static void pic32_spi_remove(struct platform_device *pdev)
pic32s = platform_get_drvdata(pdev);
pic32_spi_disable(pic32s);
- clk_disable_unprepare(pic32s->clk);
pic32_spi_dma_unprep(pic32s);
}