spi: mpc5xxx-psc: use devm_clk_get_enabled() for core clock

Use devm_clk_get_enabled() to simplify the code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230306183115.87314-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Andy Shevchenko 2023-03-06 20:31:13 +02:00 коммит произвёл Mark Brown
Родитель 208ee586f8
Коммит 9e21720a49
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
1 изменённых файлов: 4 добавлений и 35 удалений

Просмотреть файл

@ -54,8 +54,6 @@ struct mpc512x_psc_spi {
struct mpc512x_psc_fifo __iomem *fifo; struct mpc512x_psc_fifo __iomem *fifo;
unsigned int irq; unsigned int irq;
u8 bits_per_word; u8 bits_per_word;
struct clk *clk_mclk;
struct clk *clk_ipg;
u32 mclk_rate; u32 mclk_rate;
struct completion txisrdone; struct completion txisrdone;
@ -499,25 +497,15 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *pdev)
return ret; return ret;
init_completion(&mps->txisrdone); init_completion(&mps->txisrdone);
clk = devm_clk_get(dev, "mclk"); clk = devm_clk_get_enabled(dev, "mclk");
if (IS_ERR(clk)) if (IS_ERR(clk))
return PTR_ERR(clk); return PTR_ERR(clk);
ret = clk_prepare_enable(clk);
if (ret)
return ret;
mps->clk_mclk = clk;
mps->mclk_rate = clk_get_rate(clk); mps->mclk_rate = clk_get_rate(clk);
clk = devm_clk_get(dev, "ipg"); clk = devm_clk_get_enabled(dev, "ipg");
if (IS_ERR(clk)) { if (IS_ERR(clk))
ret = PTR_ERR(clk); return PTR_ERR(clk);
goto free_mclk_clock;
}
ret = clk_prepare_enable(clk);
if (ret)
goto free_mclk_clock;
mps->clk_ipg = clk;
ret = mpc512x_psc_spi_port_config(master, mps); ret = mpc512x_psc_spi_port_config(master, mps);
if (ret < 0) if (ret < 0)
@ -528,24 +516,6 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *pdev)
goto free_ipg_clock; goto free_ipg_clock;
return ret; return ret;
free_ipg_clock:
clk_disable_unprepare(mps->clk_ipg);
free_mclk_clock:
clk_disable_unprepare(mps->clk_mclk);
return ret;
}
static int mpc512x_psc_spi_of_remove(struct platform_device *pdev)
{
struct spi_master *master = dev_get_drvdata(&pdev->dev);
struct mpc512x_psc_spi *mps = spi_master_get_devdata(master);
clk_disable_unprepare(mps->clk_mclk);
clk_disable_unprepare(mps->clk_ipg);
return 0;
} }
static const struct of_device_id mpc512x_psc_spi_of_match[] = { static const struct of_device_id mpc512x_psc_spi_of_match[] = {
@ -558,7 +528,6 @@ MODULE_DEVICE_TABLE(of, mpc512x_psc_spi_of_match);
static struct platform_driver mpc512x_psc_spi_of_driver = { static struct platform_driver mpc512x_psc_spi_of_driver = {
.probe = mpc512x_psc_spi_of_probe, .probe = mpc512x_psc_spi_of_probe,
.remove = mpc512x_psc_spi_of_remove,
.driver = { .driver = {
.name = "mpc512x-psc-spi", .name = "mpc512x-psc-spi",
.of_match_table = mpc512x_psc_spi_of_match, .of_match_table = mpc512x_psc_spi_of_match,