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>
This commit is contained in:
parent
909d4cd6bc
commit
6b6cc88c4e
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user